Search code examples
javasmtpjakarta-mailmercury-mta

JavaMail API connection to Mercury Mail server error


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


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...