Email Related Notes

Exim4 Spam Filter Configuration

This is the local spam filter configuration for Exim4. This server is using mbox, the following set up should move spam mails into a separate folder.

  warn
    spam = Debian-exim
    add_header = X-Spam-Score: $spam_score\n\
              X-Spam-Score-Int: $spam_score_int\n\
              X-Spam-Bar: $spam_bar\n\
              X-Spam-Status: $spam_report
    remove_header = Subject
    add_header = Subject: ***SPAM (score:$spam_score)*** $h_Subject:
  • You should not put spam = Debian-exim:true in, somehow that forces Exim to classify every email as a spam.
  • The relevant section might be in /etc/exim4/exim4.conf.template or /etc/exim4/conf.d/acl/40_exim4-config_check_data, depending whether you store the configuration as a single file or in multiple smaller files.
  • Add ${HOME}/.forward with the following content:
# Exim filter
if "${if def:h_X-Spam-Score {def}{undef}}" is "def"
then
    save $home/mail/Spam
    finish
endif

Spam denial

Rather than re-writing the subject line of the spam, and adding extra header lines, you can also consider denying the spam message outright with an error message:

deny
      spam = Debian-exim
      message = You have sent a suspected spam. Please re-send your email to spam@auti.st

References

Standard Email Test Strings

Spam

http://spamassassin.apache.org/gtube/

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

Virus

http://www.eicar.org/86-0-Intended-use.html

X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*