Bilgehan POYRAZ wrote:
Hello everyone,

I want to block mails if include in the subject or body contain "viagra"
or "penis" keyword.
Is it possible with spamassassin or anyway.


Easy enough. If you dig in the archives about a year or two back you'll see that I posted some links concerning perl regrex and writing custom spam rules.

For a simple how-to:
create your own ruleset file (vi /etc/mail/spamassassin/70_your_rulseset.cf)
Add a rule to target specific words:
body JV_Pharm1d_Drug /cansee/i
describe JV_Pharm1d_Drug Missing a space in "can see"
score JV_Pharm1d_Drug 1.0

That will match the word "cansee" in the body of a message (the 'i' at the end tells it to ignore the case, so CanSee would match, as well as CANsee, etc.).
To match a word in the Subject line of a message:

header JV_Pharm1e_Drug Subject =~ /Pharmaceutical/i
describe JV_Pharm1e_Drug Pill ad subject line
score JV_Pharm1e_Drug 1.0
That will match the word "Pharmaceutical" in the Subject line of a message, once again ignoring case. The describe line is a human-readable description of the rule. Look at a message that gets flagged as spam and you'll see the rule hit as well as the description in the headers of the email. The score line tells spamassassin what score to assign it. Obviously you'll need to tailor this to your environment.

Once you have your rules written, it's as simple as:
spamassassin --lint
And then restarting the spamd daemon to put your shiny new rules into effect. For an easy way to start/restart/stop/etc. the spamd daemon install the Qmailtoaster-Plus package. Then to restart the spamd daemon it's a simple:
qmail-spam restart

This just scratches the surface of writing spam rules. PLEASE search the Internet on articles on writing perl regex and spamassasin rules. Here's another quick "how-to" for this:
http://wiki.apache.org/spamassassin/WritingRules





---------------------------------------------------------------------
    QmailToaster hosted by: VR Hosted <http://www.vr.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to