问题描述
我有一个Java程序,该Java程序安装在旧的Ubuntu计算机上,并使用javax.mail发送邮件.但是,那台机器崩溃了,我现在在新的CentOS机器上运行相同的Java应用程序.
I have a Java Program that was installed on an old Ubuntu machine and sent mail using javax.mail. However, that machine went down and I am now running the same Java app in a new CentOS machine.
但是,尝试使用mail.smtp.host = 127.0.0.1发送电子邮件时,出现错误"MessagingException:501语法:HELO主机名".
However, I get an error "MessagingException: 501 Syntax: HELO hostname" when trying to send an email using mail.smtp.host = 127.0.0.1.
我的猜测是该CentOS中的邮件服务器尚未激活.
My guess is that the mailserver is not yet activated in this CentOS.
我将如何配置javax.mail可以使用的邮件服务器?
How would I go about configuring a mail server that javax.mail can use?
谢谢
推荐答案
您的计算机主机名必须映射到/etc/hosts
文件中.
Your machine host name must be mapped in /etc/hosts
file.
示例:控制台显示:linux#
然后cat /etc/hostname
显示
Example:Console shows: linux#
and cat /etc/hostname
shows
linux.mydomain.com
然后编辑以root
身份运行的主机文件. vi /etc/hosts
Then edit your hosts file running as root
. vi /etc/hosts
127.0.0.1 localhost linux linux.mydomain.com
可以在此处找到详细的详细信息: https://confluence.atlassian.com/display/CONFKB/Sending+Email+Fails+Due+to+501+Syntax%3A+HELO+Hostname+Error
Good detailed info can be found here: https://confluence.atlassian.com/display/CONFKB/Sending+Email+Fails+Due+to+501+Syntax%3A+HELO+Hostname+Error
这篇关于具有javax.mail和CentOS的邮件服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!