Discussion:
Max Message and Attachment Sizes
Michael Mansour
2007-06-08 12:17:15 UTC
Permalink
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.

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.

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.

Thankyou.

Michael.



---------------------------------
How would you spend $50,000 to create a more sustainable environment in Australia? Go to Yahoo!7 Answers and share your idea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20070608/39557caf/attachment.html
Julian Field
2007-06-08 14:48:51 UTC
Permalink
Skipped content of type multipart/alternative-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.mailscanner.info/pipermail/mailscanner/attachments/20070608/44c39a4d/PGP.bin
Hugo van der Kooij
2007-06-09 03:04:29 UTC
Permalink
The maximum message size includes the size of the body of the message plus
the Base64-encoded attachments.
Most admins know that a 9.9 MB file gets expanded by 4/3 factor so it will
not fit into a 10 MB message size limit.

But I keep running into people who are not aware that email results in a
33% overhead on each (binary) file.

Hugo.
--
***@vanderkooij.org http://hugo.vanderkooij.org/
This message is using 100% recycled electrons.

Some men see computers as they are and say "Windows"
I use computers with Linux and say "Why Windows?"
(Thanks JFK, for the insight.)
Michael Mansour
2007-06-09 05:48:08 UTC
Permalink
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 <***@ecs.soton.ac.uk> 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

and:

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

# cat ./rules/maximum.attachment.size.rules
To: *@example.com 10M
To: *@example.com.au 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 example.com 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 domain3.com show that for email to ***@domain3.com
# has a limit of 5Mbytes per message, while email to any other user
# @domain3.com has a limit of 500Kbytes per message.
#

To: *@domain1.com 10M
To: *@domain2.com 20M
From: ***@domain3.com 5M
From: *@domain3.com 500K

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

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

??

Thanks.

Michael.
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.

Thankyou.

Michael.



---------------------------------
How would you spend $50,000 to create a more sustainable environment in Australia? Go to Yahoo!7 Answers and share your idea.

Jules
--
Julian Field MEng CITP
www.MailScanner.info Buy the MailScanner book at www.MailScanner.info/store MailScanner customisation, or any advanced system administration help? Contact me at ***@Jules.FM PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654 For all your IT requirements visit www.transtec.co.uk
--
MailScanner mailing list
***@lists.mailscanner.info
http://lists.mailscanner.info/mailman/listinfo/mailscanner

Before posting, read http://wiki.mailscanner.info/posting

Support MailScanner development - buy the book off the website!


Send instant messages to your online friends http://au.messenger.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20070609/2b54224f/attachment.html
Michael Mansour
2007-06-09 11:33:47 UTC
Permalink
Hi Hugo,
The maximum message size includes the size of the body of the message plus
the Base64-encoded attachments.
Most admins know that a 9.9 MB file gets expanded by 4/3 factor so it will
not fit into a 10 MB message size limit.

But I keep running into people who are not aware that email results in a
33% overhead on each (binary) file.
Hmm.. that may be the problem then. So instead of putting 10M I really should be putting 9.5M or 9M?

Michael.
Hugo.



---------------------------------
How would you spend $50,000 to create a more sustainable environment in Australia? Go to Yahoo!7 Answers and share your idea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20070609/b66cd166/attachment.html
Hugo van der Kooij
2007-06-09 13:24:23 UTC
Permalink
Post by Michael Mansour
Hmm.. that may be the problem then. So instead of putting 10M I really should be putting 9.5M or 9M?
You are not doing the math. So a 5 mB zip file is expanded using the
formula to: 5 * 4 /3 = 6.67 MB

If you want a 5MB binary attachment to be the max you must set your limit
to 6.7 MB to handle the overhead of base64 encoding.

Hugo.

PS: Please learn yahoo to indent when you reply. (Or better: get awway
from yahoo and other free emailsystems)
--
***@vanderkooij.org http://hugo.vanderkooij.org/
This message is using 100% recycled electrons.

Some men see computers as they are and say "Windows"
I use computers with Linux and say "Why Windows?"
(Thanks JFK, for the insight.)
Gareth
2007-06-10 13:26:50 UTC
Permalink
-----Original Message-----
Mansour
Sent: 09 June 2007 06:34
To: MailScanner discussion
Subject: Re: Max Message and Attachment Sizes
Hi Hugo,
The maximum message size includes the size of the body of the
message plus
the Base64-encoded attachments.
Most admins know that a 9.9 MB file gets expanded by 4/3 factor
so it will
not fit into a 10 MB message size limit.
But I keep running into people who are not aware that email results in a
33% overhead on each (binary) file.
Hmm.. that may be the problem then. So instead of putting 10M I
really should be putting 9.5M or 9M?
Michael.
Hugo.
No if they only permit mails up to 10MB then the size of the attachment they
cac accept is approx 10*3/4 = 7.5MB. You should therefore set the attachment
size to 7MBjust to be sure.

Continue reading on narkive:
Loading...