After a lot of researching we finally found out why the default .NET SmtpClient and (most likely) the Aspose SmtpClient sometimes fail with a timeout to some smtp-servers. It seems both are failing on a feature of Postfix 2.8 (and higher) called “Pre-greet”.
Normally all mail servers will start with:
“220 mail.something.whatever ESMTP Something”
However, when Pre-greet is enabled, a Postfix server will start it’s greet with:
“220-mail.something.whatever ESMTP Postfix”
And about 5-20s later will send the normal greet:
“220 mail.something.whatever ESMTP Postfix”
It seems the SmtpClient either responds too soon (e.g. on the invalid 220-message) or gets confused. After that, the mail connection will wait until the timeout is reached.
To test this bug you can try to send an email to the following E-mail address:
noreply@online.nl
Using their SMTP server:
smtp-in.online.nl
You’ll find out that you can’t send an email to supplied email address because the SmtpClient fails on the Pre-greet.
More info in a MS-bug report:
<span style=“font-size:11.0pt;font-family:“Calibri”,“sans-serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
NL;mso-fareast-language:NL;mso-bidi-language:AR-SA”>http://connect.microsoft.com/VisualStudio/feedback/details/685280/system-net-mail-smtpclient-fails-to-send-to-postfix-when-pre-greet-filter-is-enabled
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
NL;mso-fareast-language:NL;mso-bidi-language:AR-SA”>http://connect.microsoft.com/VisualStudio/feedback/details/685280/system-net-mail-smtpclient-fails-to-send-to-postfix-when-pre-greet-filter-is-enabled
Info about Postfix Pre-greet:
Regards, Jerremy