How do you get JavaMail to tell SMTP to send the domain name along with the HELO command to avoid a MessagingException "501 HELO requires domain address"?

John Zukowski

From Sun's JavaMail FAQ:

The SMTP provider uses the results of InetAddress.getLocalHost().getHostName() in the SMTP HELO command. If that call fails to return any data, no name is sent in the HELO command. Check your JDK and name server configuration to ensure that that call returns the correct data. Starting with JavaMail 1.1.3, you may also set the mail.smtp.localhost property to the name you want to use for the HELO command.