PHP   发布时间:2019-11-09  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了php – sSMTP不再有效 – ‘响应无效:501 5.5.4 HELO / EHLO参数MYEMAILADDRESS@gmail.com无效,关闭连接.’大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
正如标题/标签所说,我在 Linux上为 PHP服务器运行sSMTP.

每当我尝试发送电子邮件时,我都会收到这些错误(不会出现在PHP中,只会出现在日志/’sudo service sendmail status’或’sudo service php5-fpm status’)

来自/var/log/mail.log

Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Creating SSL connection to host
Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Invalid response: 501 5.5.4 HELO/ELO argument MYEMAILADDRESS@gmail.com invalid,closing connection. v74sm9147441pfa.7- gsmtp (MYEMAILADDRESS@gmail.com)
Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: SSL connection using (null)
Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Cannot open smtp.gmail.com:587

来自/var/log/mail.err和mail.warn

Mar 31 03:34:10 ip-172-31-22-38 sSMTP[1997]: Cannot open smtp.gmail.com:587
Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Invalid response: 501 5.5.4 HELO/EHLO argument MYEMAILADDRESS@gmail.com invalid,closing connection. v74sm9147441pfa.7 - gsmtp (MYEMAILADDRESS@gmail.com)
Mar 31 03:34:34 ip-172-31-22-38 sSMTP[2004]: Cannot open smtp.gmail.com:587

我的/etc/ssmtp/ssmtp.conf

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=MYEMAILADDRESS@gmail.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
hostname=MYEMAILADDRESS@gmail.com

AuthUser=MYEMAILADDRESS@gmail.com
AuthPass=[removed]
UseSTARTTLS=YES
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

我的重估

root:MYEMAILADDRESS@gmail.com:smtp.gmail.com:587
localusername:MYEMAILADDRESS@gmail.com:smtp.gmail.com:587

解决方法

我的ssmtp.conf包含hostname=xxx@gmail.com,我将其更改为hostname = localhost,问题解决了.

大佬总结

以上是大佬教程为你收集整理的php – sSMTP不再有效 – ‘响应无效:501 5.5.4 HELO / EHLO参数MYEMAILADDRESS@gmail.com无效,关闭连接.’全部内容,希望文章能够帮你解决php – sSMTP不再有效 – ‘响应无效:501 5.5.4 HELO / EHLO参数MYEMAILADDRESS@gmail.com无效,关闭连接.’所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: