Subject: | $ENV{HTTP_HOST} on non-standard port causes syntactically invalid EHLO |
If Mail::Sender is called from code running within a web server (e.g. mod_perl or CGI code), it may use $ENV{HTTP_HOST} to initialise various things. If the webserver is running on a non-standard port this variable is set to a string containing a colon (e.g. "localhost:10001"), and is so not a syntactically valid hostname. This string is used to construct the EHLO request in the SMTP session, causing some SMTP servers to barf.
Verified in CGI code running under Apache/2.0.40 (Red Hat Linux), with Perl v5.8.0, Mail::Sender 0.8.10, talking to Exim 4.24.
Workaround: Set $ENV{HOSTNAME} properly in your code, and $ENV{HTTP_HOST} will not be used.