content filtering with MailScanner 4.44 + postfix 2.1.5 on FC3

Julian Field MailScanner at
Sat Jun 10 15:29:55 IST 2006

Hash: SHA1

ankush grover wrote:
> hey friends,
> I am using MailScanner 4.44 with postfix 2.1.5 on FC3. I want to do
> some kind of content filtering
You can do pretty much all of these with MailScanner "rulesets". Read up 
about rulesets in any and/or all of the documentation available.
Please buy the book!
> a) Banning  receiving & sending attachments for some users for example
>       "ankush at" is not allowed to send or receive any 
> attachments.

In MailScanner.conf,
    Maximum Attachment Size = %rules-dir%/max.attach.size.rules

In /etc/MailScanner/rules/max.attach.size.rules
    FromOrTo: ankush at   0
    FromOtTo: default      -1

> b) Banning receiving emails for some users from the all other domains
> except from
>    one domain  for example if there is any email for user
> "tom at" from
>    any other domain that mail should be dropped but this user should
> be able to
>    receive mail from the domain but not from anyother domain.

In MailScanner.conf,
    Is Definitely Spam = %rules-dir%/is.definitely.spam.rules
    Definite Spam Is High Scoring = yes
    High-Scoring Spam Actions = delete store

In /etc/MailScanner/rules/is.definitely.spam.rules
    To:   tom at   and   From: * no
    To:   tom at   yes
    FromOrTo: default no

> c) People are still sending mails to the accounts of the ex employees
> I want to
>    totally ban mails to those accounts both within the organisation 
> and from
>    outside  means if the mail is for the user   "john at"  
> that mail
>    should get dropped.

Do this in your MTA. In sendmail, for example, add this to /etc/mail/access
john at   DISCARD
    cd /etc/mail

> If anyone can give me examples for the above 3 problems of mine that
> will be very good and I will be very grateful to that person.
Hopefully the examples above give you a small taste of the power of 
rulesets. Virtually every configuration option in MailScanner can be 
controlled by a ruleset, and these can be built into incredibly detailed 
configuration systems. As long as you have less than, say, 1000 entries 
in a particular ruleset, they will work very fast.

If you come across a requirement which cannot be expressed in a ruleset, 
then you can use "Custom Functions", which are Perl functions that 
calculate the result of the configuration option from a section of Perl 
code that is passed all the details about the message. There are a few 
examples of what can be done in Custom Functions in 
/usr/lib/MailScanner/MailScanner/ and in the extra 
examples in /usr/lib/MailScanner/MailScanner/CustomFunctions/*.

These do require some basic knowledge of Perl, but you can start from 
one of the examples and modify it to your needs, so you don't have to 
start from scratch. If you want Custom Functions written by me for your 
particular needs, please contact me directly and we can agree a price. 
You get MailScanner for free, and you get all the support I can possibly 
offer for free on the mailing list and in personal replies to mail (I 
reply to *every* email I get, always). But if you want me to write code 
for you, I have to charge for that. I have bills to pay, like everyone else.


- -- 
Julian Field
Buy the MailScanner book at
Professional Support Services at
MailScanner thanks transtec Computers for their support

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654

Version: PGP Desktop 9.0.6 (Build 6060)


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

More information about the MailScanner mailing list