This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
We are using JavaMail to send Mails via Java Application.
JavaMail is using relay server to relay mail.
Relay server is not able to relay the mail and fails with just sendException : Mail Server failed to Relay message and nothing more than that.
We get hostname like this : String currentHost = InetAddress.getLocalHost().getHostName();
According to API documentation: InetAddress.getHostName() is doing a reverse lookup on the server's IP address using the naming service (DNS) configured in your O/S.
hosname returns as mcc12345
In server configuration : /etc/hosts file
Since InetAddress.getLocalHost().getHostName() returns mcc12345
JavaMail is not able to resolve it to fully qualified address.
Is there any change in /etc/hosts configuration file which would help return the correct Host name?
What else can be done other than using another method call - InetAddress.getLocalHost().getCanonicalHostName()?
Code Change is NOT an welcome OPTION at this point , so looking at configuration changes on Server to help..