I needed to get some software from a lab that only distributes the software as .zip attachments by email. Let's ignore the wisdom of choosing that distribution method in 2016 (nowadays most mail setups strip out zipped attachments) and instead focus on the problem at hand.
I set up a local account on a RHEL7 server running Postfix. When the message was sent to me, this is what appeared in the logs:
mailserver postfix/smtpd[5416]: connect from mail.example.com[203.0.113.78]
mailserver postfix/smtpd[5416]: lost connection after EHLO from mail.example.com[203.0.113.78]
mailserver postfix/smtpd[5416]: disconnect from mail.example.com[203.0.113.78]
An immediate disconnection! But why? I sent test email messages from two different external email accounts and they were accepted and delivered just fine.
I turned on postfix's per-host debugging to get more information. I added the following to /etc/postfix/main.cf and did a postfix reload
.
debug_peer_list = 203.0.113.78
I also changed debug_peer_level from its default of 2 to its maximum value of 3. Now I could see what postfix is telling the client when it connects:
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-mailserver.fqdn
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-PIPELINING
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-SIZE 10240000
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-VRFY
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-ETRN
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-ENHANCEDSTATUSCODES
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-8BITMIME
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250 DSN
Aha. Maybe the message size limit is too small for the mail attachment and the client is just shaking its head and disconnecting. Added the following to /etc/postfix/main.cf and did postfix reload
:
message_size_limit = 20480000
Hurrah! That was the problem. Now after the following being sent to the client it continues the connection and sends the mail:
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-mailserver.fqdn
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-PIPELINING
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-SIZE 20480000
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-VRFY
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-ETRN
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-ENHANCEDSTATUSCODES
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250-8BITMIME
mailserver postfix/smtpd[6125]: > mail.example.com[203.0.113.78]: 250 DSN
...
mailserver postfix/smtpd[6125]: 80EAC40D6F56: client=mail.example.com[203.0.113.78]
mailserver postfix/cleanup[6129]: 80EAC40D6F56: message-id=<83748A32.egglDIEJFL@example.com>
Don't forget to turn debugging off afterwards!