9/04/2015

Javax email, send hello error fix


javax depends on an environment variable to find the hostname when starting an SMTP msg hand-off to another server. The hostname can be set by a java developer so that it doesn't have to look it up, but a developer often skips or overlooks it. The method used to resolve the hostname between java and the os often breaks, especially in new linux distros (deprecation of network tools, refactoring of libraries, tossing things overboard). Under RHEL and Centos using the /etc/hosts file often fails if the hostname is appended to the end of along list of aliases, java only checks the first alias.

Fix:

make sure the hostname is placed at the front of a list of aliases in /etc/hosts

Example:

127.0.0.1 myhostname localhost localhost.localdomain