Resolve javamail Send mail javax.mail.messagingexception:501 syntax:helo hostname problem __java

Source: Internet
Author: User

A few days ago, when using JavaMail to send Mail on a Linux server, it always reported javax.mail.messagingexception:501 syntax:helo hostname this error, In the confirmation of the message sent by the host is not a problem, and in the local Windows environment, it is normal to send, this is a bit weird, it is not recently good character. Well, after a toss, I finally found the reason.

Solution:
1, first use hostname to view the server's host name, and then the local exploratory ping this hostname, unfortunately found not the corresponding IP host.
2, modify/etc/hosts file, add hostname name corresponding to the 127.0.0.1 top, OH. Send a message at a time, success.

Reason:
JavaMail send a message, will be extracted after the local hostname, will be the form of IP to send mail, but under the Linux server, can not resolve the hostname corresponding native IP address, resulting in JavaMail can not invoke IP send. Postfix received this message will refuse to send, resulting in a 501 error. (Windows Server can send, is because of the use of the non-NetBIOS protocol to obtain the host's IP address, so you can obtain IP)

screenshot Operation:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.