If you get the following error and not sure how to fix it then read on.
Caused by: javax.mail.MessagingException: 501 Syntax: HELO hostname
This is typically caused by the system property “mail.smtp.localhost” not being set by your Java VM. This should be already set for you automatically if your runtime environment is configured properly.
From the javadoc:
Local host name used in the SMTP HELO or EHLO command. Defaults to InetAddress.getLocalHost().getHostName(). Should not normally need to be set if your JDK and your name service are configured properly.
Hope this helps.