Marking Subject of SPAM

From Veximwiki

Jump to: navigation, search

If you want to mark the subject of SPAM that is getting tagged with X-Spam-Flag. So some broken email clients can filter it and its a bit more obvious to users.

This will add the X-New-Subject iff appropriate (uses the same lookup as the X-Spam-Flag header in the main vexim config file) The system filter will rewrite the subject if this header exists.

In vexim-acl-check-content.conf:

#Always add X-Spam-Score and X-Spam-Report headers, using SA   system-wide settings
#(user "spam"), no matter if over threshold or not.
warn  message = X-Spam-Score: $spam_score
      spam = spam:true
warn  message = X-Spam-Report: $spam_report
      spam = spam:true
warn  message = X-Spam-Bar: $spam_bar
      spam = spam:true
#tag the message as spam as per user settings..
warn  message = X-New-Subject: [SPAM] $h_subject
       spam = spam
       condition = ${if >{$spam_score_int}{${lookup mysql\
               {select users.sa_tag *10 from users,domains \
              where localpart = '${quote_mysql:$local_part}' \
               and domain = '${quote_mysql:$domain}' \
               and users.on_spamassassin = '1' \
               and users.domain_id=domains.domain_id \
               and users.sa_tag > 0 }{$value}fail}} {yes}{no}}

Then make a system filter with this in it. Don't forget to add system_filter= to your main exim config.

 # Exim Filter
 if "${if def:header_X-New-Subject: {there}}" is there
 then
 headers remove Subject
 headers add "Subject: $h_X-New-Subject:"
 headers remove X-New-Subject
 endif

Add system filter here, in /usr/exim/configure:

 ######################################################################
 #                    MAIN CONFIGURATION SETTINGS                     #
 ######################################################################
 system_filter = /usr/exim/system_filter.conf

Note: This whole thing does not work. The variables $local_part and $domain are not available at acl_smtp_data time (see http://exim.org/exim-html-4.62/doc/html/spec_html/ch39.html#id2662860). The MySQL query fails and the message is always tagged when the score exceeds the default SpamAssassin score (not the user defined score).

See http://www.schirmacher.de/display/INFO/Vexim Modification for a different approach which works.

Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=221698

Personal tools