Max Message and Attachment Sizes

Michael Mansour micoots at
Sat Jun 9 00:48:04 IST 2007

Hi Julian,

Firstly, thanks for the reply. I'm surprised to see you back into the swing of things so soon, but am glad you're back.

Julian Field <MailScanner at> wrote:      Michael Mansour wrote: Hi,
 The following two options seem to be the only ones to control this:
 # The maximum size, in bytes, of any message including the headers.
 # If this is set to zero, then no size checking is done.
 # This can also be the filename of a ruleset, so you can have different
 # settings for different users. You might want to set this quite small for
 # dialup users so their email applications don't time out downloading huge
 # messages.
 Maximum Message Size = %rules-dir%/maximum.message.size.rules
 # The maximum size, in bytes, of any attachment in a message.
 # If this is set to zero, effectively no attachments are allowed.
 # If this is set less than zero, then no size checking is done.
 # This can also be the filename of a ruleset, so you can have different
 # settings for different users. You might want to set this quite small for
 # large mailing lists so they don't get deluged by large attachments.
 Maximum Attachment Size = %rules-dir%/maximum.attachment.size.rules
 My problem is that I have set one domain to limit by 10M for each of the options above, but the problem is reading each option more carefully, it doesn't seem to talk about the _total_ size of the message plus attachement, only the size limit for each attachment onto a message.
  The maximum message size includes the size of the body of the message plus the Base64-encoded attachments.
 Ok, if that's the case then it's not working for me.

My setup is like this:

Maximum Message Size = %rules-dir%/maximum.message.size.rules
Maximum Attachment Size = %rules-dir%/maximum.attachment.size.rules
Minimum Attachment Size = -1


# cat ./rules/maximum.message.size.rules
To:             *       10M
To:             *    10M
FromOrTo:       default                 0

# cat ./rules/maximum.attachment.size.rules
To:             *       10M
To:             *    10M
FromOrTo:       default                 -1

Yet when the SMTP server accepts the email and delivers to Mailscanner, both of my MX servers (where MailScanner runs) keep trying to send to the SMTP server every 15 minutes.

When looking at each the MX servers mail queue, the message sizes are over 10Mb.
 What I need is for any message for a particular domain (which I setup in each rules file above) that is over a _total_ of 10M, regardless if that 10Mb is made up of multiple xmb files or not, to be rejected with an email back to the sender explaining the email is too big.
  Use the Maximum Message Size.
 Reading the max.message.size.rules file:

# The 2 lines involving show that for email to user at
# has a limit of 5Mbytes per message, while email to any other user
# has a limit of 500Kbytes per message.

To:       *     10M
To:       *     20M
From:     user at   5M
From:     *     500K

So does this mean I need to change my ruleset above instead to:

# cat ./rules/maximum.message.size.rules
 From:             *       10M
 From:             *    10M
 FromOrTo:       default                 0


 For a history of why I need this, I route mail for a domain (virus/spam scanning) who run Exchange, so once Mailscanner does its job, it sends to their Exchange SMTP server. Their Exchange limits to 10Mb and then drops the connection.
 My end keeps retrying to send every 15mins forever, so their bandwidth costs skyrocket.
 I looked at blocking this at the MTA level (sendmail), but then feared that the sending smtp server would keep trying every 15mins and send our bandwidth costs through the roof. So I instead decided to let the MTA accept the message and pass it to MailScanner, which was then set to the 10Mb limit, and would also bounce the message back to the sender with the reason why (configured in MailScanner).
 But instead, I'm seeing the same occurance with any emails above 10mb trying to be sent from my SMTP server to the Exchange SMTP server.
 If MailScanner could say "any message totalling 10Mb is rejected" then I think this would solve the problem. Either that or find a way to tell MailScanner/sendmail to stop trying to send a message if it fails x number of times?
 Any help or advice is much appreciated.
How would you spend $50,000 to create a more sustainable environment in Australia? Go to Yahoo!7 Answers and share your idea.  

Julian Field MEng CITP Buy the MailScanner book at  MailScanner customisation, or any advanced system administration help? Contact me at Jules at Jules.FM  PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654 For all your IT requirements visit 
MailScanner mailing list
mailscanner at

Before posting, read

Support MailScanner development - buy the book off the website! 

 Send instant messages to your online friends 
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the MailScanner mailing list