Attachment stripping - wrong postfix message size

Markus Nilsson markus at
Tue Mar 23 16:07:49 GMT 2010

Hi again,

I've done a little bit of searching around in the source, enabled some debug prints etc, and can't find anywhere that the C-record metadata read from the original queuefile is edited. Am I missing something here, or is MailScanner ignoring any changes made to the mail in respect to size, and just lets the queue file keep its original C record?

I would really need my postfix instance to give a correct estimation of the message size to the receiving mailserver when starting delivert since I am stripping away any large attachments, and the mails are quite smaller after being processed by MS!


----- Original Message -----
From: "Markus Nilsson" <markus at>
To: mailscanner at
Sent: tisdag, 23 mar 2010 10:53:07
Subject: Attachment stripping - wrong postfix message size


I'm having a problem with a custom function for attachment stripping based on total attachment size. The custom function is made for 

Maximum Attachment Size = 

I successfully return 1 if the summed size of all attachments are larger than my configured value, and -1 otherwise. The custom function also stores the attachments in a safe place for later retrieval. I then want MailScanner/postifx to deliver the stripped mail to the recipient(s). MailScanner seems to do it right, but for some reason when postfix delivers the mail to the receiving mail server, it reports the message size as it was before the stripping, so that server might reject the mail even though it really isn't that big.

If I configure the mailserver to accept larger sizes, the received mail has the correct size (small, all attachments stripped), so the reported size by postfix is not correct!

Does postfix somehow approximate the message size? 
If so, is it possible to help postifix with this approximization?
Or am I completely missing something else out?

Any help greatly appreciated!


MailScanner mailing list
mailscanner at

Before posting, read

Support MailScanner development - buy the book off the website! 

More information about the MailScanner mailing list