• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Is there a way to block a message by a specific email SUBJECT?

Z

ZaNaToS

Guest
I/ve red the following article in the kb of swsoft about blocking emails in spamassassin depending on what they contain in the subject : http://kb.swsoft.com/article_123_1038_en.html


Custom filter rules can be defined in /etc/mail/spamassassin/local.cf, for example:

header CUSTOM_SUPERSPAM Subject =~ /.*spam subject.*/i
describe CUSTOM_SUPERSPAM Superspam messages
score CUSTOM_SUPERSPAM 100.0

I've tried that, for example with this:

header CUSTOM_SUPERSPAM Subject =~ /.*viagra.*/i

and it worked fine, my question is, how can I add multiple different subjects? (many words or phrases ?)
 
Theres more that one way to do it, but an easy way would be to expand your regular expression:

header CUSTOM_SUPERSPAM Subject =~ /.*(viagra|levitra|calis).*/i

that would match (case insensitive) against the words viagra, levitra, or calis anywhere in the subject line.
 
thank you very much, what could be the other ways ?

could I give it a variable that would open a "text" file with all the forbidden words?
 
Bayes would be the other method in I would use in Spamassassin. You'd want to train it against those messages that otherwise arent being missed. qmail-scanner has the ability to block messages by the subject line, viagra is one of the rules it has on by default. Otherwise you'd want to augment your SA installation with other tools, like pyzor, dcc and razor if you havent already.
 
I am in need of the same solution. I have tried the above custom rule with spamassassin as well as modifying the ".qmail" files, but nothing works.

With the spamassassin config, here is my config:

Code:
required_hits   3
rewrite_subject 1
subject_tag     *****SPAM*****
report_safe 0

header CUSTOM_SUPERSPAM Subject =~ /.*(viagra|levitra|cialis).*/i
describe CUSTOM_SUPERSPAM Superspam messages
score CUSTOM_SUPERSPAM 100.0

I have this exact same config in my local.cf as well as in my email user's user_prefs. If I send an email with any of those in the subject, it still passes.

Any ideas?
 
BTW, I checked my spamassassin version and it is 2.6.3. I am on plesk 7.5.4.
 
I just realized that I have to enable spamassassin for each user in plesk. Some things are getting blocked, but I need to add some subject checking. I have added this:

Code:
required_hits	6
rewrite_subject	1
subject_tag	*****SPAM*****
report_safe 0

header CUSTOM_SUPERSPAM Subject =~ /.*(viagra|The United States National Medical Association|cialis).*/i
describe CUSTOM_SUPERSPAM Superspam messages
score CUSTOM_SUPERSPAM 100.0


I added it to my local.cf, and BOTH user_prefs files. Yes, I suddenly have 2 of them in 2 different places for my user. I have plesk set to use server wide settings AND personal settings. I have my user set to use server settings.

I am baffled!!!!
 
Back
Top