setup filetype and filename rules per domain

Julian Field mailscanner at
Mon Aug 7 18:54:43 IST 2006

Hash: SHA1

Kevin Miller wrote:
> Julian Field wrote:
>> In recent versions (version 4.49 and onwards) there are some new
>> configuration settings,
>> 	Allow Filenames
>> 	Deny Filenames
>> 	Allow Filetypes
>> 	Deny Filetypes
>> These are not as flexible as the filename.rules.conf and
>> filetype.rules.conf files, but you may find them easier to use and
>> good enough for your requirements.
>> For an example, let's say that domain wants to be able to
>> email files called "*.mp3" and "*.wav". You would still need to do
>> similar setups to stop the "filetype.rules.conf" file trapping movies
>> in general. But let's keep it simple for this example.
>> 1) We need to tell MailScanner to create a ruleset for "Allow
>> Filenames" so we can vary the value of this setting depending on
>> where the mail is going to.
>> In MailScanner.conf, set
>> Allow Filenames = %rules-dir%/allow.filenames.rules
>> 2) Create the ruleset. This just needs to allow *.mp3 and *.wav for
>> mail going to anyone at
>> In /etc/MailScanner/rules/allow.filenames.rules, put
>> To: \.mov$ \.mp3$
>> Note that the text to the right of "" is a space-separated list
>> of regular expressions. You need to put the "\" before the "." as
>> otherwise "." would just match any character, not just the actual
>> "full stop" character. "$" matches the "end of line", ensuring that
>> the ".mov" appears at the end of the filename.
> Thanks for the quickie tutorial Julian.  Just a simple sanity check:  I
> presume that in allow.filenames.rules that we can use the From: or
> FromOrTo: nomenclature as well as the To: tag?


> Are tab seperators required between operators?

One of the main features that the filename.rules.conf file provides that 
is better than the method above, is that the matching regular 
expressions can include spaces, which the method above cannot.

- -- 
Julian Field
Buy the MailScanner book at

MailScanner customisation, or any advanced system administration help?
Contact me at Jules at

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Get your PCs and servers from, very well built and reliable!

Version: PGP SDK 3.7.0
Charset: ISO-8859-1


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