解决发邮件出现“501 Domain address required: HELO”问题

本文探讨了在使用邮件服务器时遇到的hostname解析问题导致邮件发送失败的现象,并通过修改/etc/hosts文件解决此问题的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天出现了一个奇怪的问题,产品机A上有一个邮件服务器,产品机A和产品机B的java程序都是用A上的邮件服务器发邮件,但是测试发现,产品机B上的java程序发送邮件正常,而产品机A上的java程序发送不出去,更奇怪的是A上的php程序也能够发送邮件!

查到tomcat日志如下:
 
  1. javax.mail.MessagingException: 501 Domain address required: HELO  
  2. at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1481)  
  3. at com.sun.mail.smtp.SMTPTransport.helo(SMTPTransport.java:917)  
  4. at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:417)  
  5. at javax.mail.Service.connect(Service.java:288)  
  6. at javax.mail.Service.connect(Service.java:169)  
  7. at 
比较了A和B的java程序,完全一模一样。
查了半天百度,google都没有结果
最后找到了一个说法是因为hostname引起的,于是我用hostname命令查到了A的hostname是PRODA,而ping 它却是没有结果,看了一下/etc/hosts文件中,发现“127.0.0.1 PROD-A”,写多了一杠

 
改好之后再测试就能够发送了
我估计虽然传的是server的域名,但是mail.jar会先获取本机的hostname进行解析,解析不到就不发送HELO命令了,但是Server需要检测这个命令。而php的发邮件程序实现时不判断hostname就直接发送HELO命令,因此能够发送成功
请翻译:202.192.1.5 is making SMTP connections which indicate that it is misconfigured. Some elements of your existing configuration create message characteristics identical to previously identified spam messages. Please align the mail erver's HELO/EHLO 'icoremail.net' with proper DNS (forward and reverse) values for a mail server. Here is an example: Correct HELO/DNS/rDNS alignment for domain example.com: - Mail server HELO: mail.example.com - Mail server IP: 192.0.2.12 - Forward DNS: mail.example.com -> 192.0.2.12 - Reverse DNS: 192.0.2.12 -> mail.example.com Correcting an invalid HELO or a HELO/forward DNS lookup mismatch will stop the IP from being listed again. Points to consider: * Alignment: it is strongly recommended that the forward DNS lookup (domain name to IP address) and rDNS (IP to domain) of your IP should match the HELO value set in your server, if possible * The IP and the HELO value should both have forward and rDNS, and should resolve in public DNS * Ensure that the domain used in HELO actually exists! Additional points: * According to RFC, the HELO must be a fully qualified domain name (FQDN): "hostname.example.com" is an FQDN and "example.com" is not an FQDN. * The domain used should belong to your organisation. * HELO is commonly a server setting, not DNS. Contact your hosting provider for assistance if needed. You can test a server's HELO configuration by sending an email from it to helocheck@abuseat.org. A bounce that contains the required information will be returned immediately. It will look like an error, it is not. Please examine the contents of this email. If all settings are correct, you have a different problem, probably malware/spambot. Again, the HELO we are seeing is 'icoremail.net'. The last detection was at 2023-05-27 13:35:00 (UTC). For information on misconfigured or hacked SMTP servers and networks, please see this FAQ: https://www.spamhaus.org/faq/section/Hacked...%20Here's%20help#539 CSS listings expire a few days after last detection. You can always open a ticket (or update an existing one) to inform us when and how the situation was been secured.
05-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值