We are using qmail as a mail server.
If a user sends an email that cannnot be delivered he get's a message back from qmail with some details about this error.
Hi. This is the qmail-send program at our.server.tld
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
<[email protected]>:
123.123.123.123 failed after I sent the message.
Remote host said: 552 5.3.4 Message is too large, rejected.
--- Below this line is a copy of the message.
... header information ...
... message ...
... attachments in base64 ...
------_=_NextPart_001_000A0F27.508A4479--
------_=_NextPart_000_000A0F27.508A4479
Content-Type: application/pdf;
name="file.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="file.pdf";
modification-date="Wed, 24 Oct 2012 14:27:24 +0000"
JVBERi0xLjUNCiXi48/TDQo0IDAgb2JqDQo8PA0KL1R5cGUgL1BhZ2UNCi9QYXJlbnQgMiAwIFIN
Ci9Db250ZW50cyA1IDAgUg0KL01lZGlhQm94IFstMC4wMDAwIC0wLjAwMDAgMTcwMC43ODc0IDIy
...
It is fine to have a copy of the message with the header and message information. But is it possible to tell qmail not to include the full attachment into this error message? This is a big overhead and it would be best to just limit the size of the message to a few kb since the user can't do anything with the base64 stream anyway.
As far as I know there is no way to do this in vanilla Qmail. DJB had his own weird ideas of how things should work. Ofcourse just like everything else in QMail world there is a patch that does approximately what you want. If you are already using JMS's combined patch it is already included in there.
It is not a perfect solution really but still if it is critical enough and you can patch and update your qmail installation you can consider it.