Question

I am trying to connect to Mercury mail server with a java application and I am using JavaMail api. The connection is not successful and I’m getting this error in the log:

EHLO x.x.x.x
554 Invalid HELO format

Which means that it connects to the server but the helo format is not something that sever likes. I've tired to debug it and I got to this code in JavaMail “SMTPTransport” class which says:

serverOutput.write(cmdBytes);
serverOutput.write(CRLF);
serverOutput.flush();

and according to code: private static final byte[] CRLF = { (byte)'\r', (byte)'\n' };
which seems consistent with RFC 821

I know that on windows \n has different meaning but I am not sure if this really is the root of problem? If it not then what can cause this? I checked mail server with mail client and it works fine and I checked the code with James mails server and it also works fine!

JavaMail API version is: 1.4.5 (latest release)
Mercury/32 : 4.7

Was it helpful?

Solution

I did a Google search on 554 Invalid HELO format and got a ton of hits about your specific Mercury problem. It's a bug.

http://community.pmail.com/forums/thread/4136.aspx

http://www.mantisbt.org/bugs/view.php?id=9645

http://ellislab.com/codeigniter/forums/viewthread/153130/

etc...

OTHER TIPS

You might need to check the logs on the server to figure out what it's really complaining about, but... One thing you can try is setting the mail.stmp.localhost property to the correct DNS host name for your machine. From the debug output it looks like your machine is unable to determine its own name and so is sending the IP address instead.

For me in a web project the PHPMailer() class was forcing Auth. Changing the Auth to false fixed it. Maybe check similar option for setting Auth to false in your language.

This is what I changed in my PHP code from true to false and adding sendmail_from in the php.ini file

    $mail = new PHPMailer();
    $mail->SMTPAuth = false;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top