Skip to content

Instantly share code, notes, and snippets.

@metalefty
Last active November 8, 2018 00:22
Show Gist options
  • Save metalefty/1a1d60a9d320f396075fa4759799259b to your computer and use it in GitHub Desktop.
Save metalefty/1a1d60a9d320f396075fa4759799259b to your computer and use it in GitHub Desktop.
SpamAssassin Japanese patch installation guide in English

Installation

Installation

Prerequisites

Beforehand, install these softwares. 2,3,4 are required to use Tokenizer::MeCab plugin. 5,6,7 are not necessary but improves detection accuracy in Japanese and Chinese.

  1. Character set encoding detector: Encode::Detect
  2. Morphological analysis engine: MeCab
  3. Dictionary for MeCab: mecab-ipadic
  4. Perl binding of MeCab: mecab-perl
  5. Japanese JIX X 0213 charset encoding module: Encode::JIS2K
  6. Chinese extended encoding module: Encode::HanExtra
  7. Microsoft Windows compatible Japanese charset encoding module: Encode::EUCJPMS

Downloads

You can download patches here: https://github.com/heartbeatsjp/spamassassin_ja/patches/

These files are required:

  • spamassassin-3.4.x-japanese-tokenizer.patch (a patch file for Japanese Tokenizer)
  • tokenizer.pre (a configuration file for Japanese Tokenizer)

Install

Extract SpamAssassin tarball and patch.

cd Mail-SpamAssassin-3.4.x
patch -p1 < spamassassin-3.4.x-japanese-tokenizer.patch

All that left is standard SpamAssassin installation procedure.

Configuration

  1. Add this line to local.cf

    normalize_charset 1
    
  2. Put tokenizer.pre to the same directory as local.cf

  3. (If you use MeCab plugin)Edit tokenizer.pre, comment out SimpleJA plugin line, uncomment MeCab plugin line.

    # Tokenizer::SimpleJA
    #
    #loadplugin Mail::SpamAssassin::Plugin::Tokenizer::SimpleJA
    
    # Tokenizer::MeCab
    #
    loadplugin Mail::SpamAssassin::Plugin::Tokenizer::MeCab
    
  4. Run spamassassin --lint to confirm no warnings

    spamassassin --lint
    
  5. Everything is done. Restart the daemon if you're using SpamAssassin as a daemon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment