MailScanner Rules

Ralph Bornefeld-Ettmann ilikeuce at
Thu Oct 15 02:00:39 IST 2009

Darvin Denmian schrieb:
> Hello,
> Firts of all : I'm new in MailScanner, so I liked to know:
> - Is there a way to create rules, to block certain types of
> attachments, per user and per domain?
> - Can this rules can be stored in Mysql ?
> Thanks !!

to respond with my old professor's words :

"in principle - yes" ;-)

1. how to block certain types of files per user/per domain :

create a file /etc/MailScanner/rules/filename.rules :

To:	john.doe at /etc/MailScanner/rules/filename.rules.jd.conf
To:	/etc/MailScanner/rules/filename.rules.ex.conf
FromOrTo:	default	/etc/MailScanner/rules/filename.rules.conf

/etc/MailScanner/filename.rules.conf can be the default ruleset shipped 
with MailScanner.

Then edit /etc/MailScanner/MailScanner.conf and change to :

Filename Rules = %rules-dir%/filename.rules

the same you can implement for filetypes.

Do not forget to restart Mailscanner after changes.

2. store rules in mysql

as mentioned before you CAN in principle store rules in mysql.
But you need

- either a job that extracts rules files from the database so 
MailScanner can read them (hourly cronjob is possibly enough)
- or a new feature that enables MailScanner to read from databases

to the latter option I have read in an earlier post here something like 
"if you can not do this yourself Julian possibly will be happy to do it 
for you - if you pay him" so don't hesitate ... he does not bite or 
scratch or eat you up ;-)

More information about the MailScanner mailing list