邮件无法通过 php 脚本发送 - VPS 配置存在一些问题

邮件无法通过 php 脚本发送 - VPS 配置存在一些问题

我无法从我的 vps 服务器上的 php 脚本发送任何电子邮件。我去检查日志,发现了以下内容:

Mar 26 05:53:30 corporatepixels sendmail[23772]: STARTTLS=client, relay=aspmx.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
Mar 26 05:54:01 corporatepixels sendmail[23772]: s2Q5rTGQ023770: to=<[email protected]>, ctladdr=<[email protected]> (498/498), delay=00:00:31, xdelay=00:00:31, mailer=esmtp, pri=120469, relay=aspmx.l.google.com. [173.194.68.27], dsn=5.0.0, stat=Service unavailable
Mar 26 05:54:01 corporatepixels sendmail[23772]: s2Q5rTGQ023770: s2Q5s1GQ023772: DSN: Service unavailable
Mar 26 05:54:01 corporatepixels sendmail[23772]: s2Q5s1GQ023772: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31687, dsn=2.0.0, stat=Sent
Mar 26 06:22:14 corporatepixels sendmail[23982]: s2Q6MEGd023982: from=nginx, size=1147, class=0, nrcpts=1, msgid=<[email protected]>, relay=nginx@localhost
Mar 26 06:22:15 corporatepixels sendmail[23983]: s2Q6MEq1023983: from=<[email protected]>, size=1375, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Mar 26 06:22:15 corporatepixels sendmail[23982]: s2Q6MEGd023982: [email protected], ctladdr=nginx (498/498), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=31147, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (s2Q6MEq1023983 Message accepted for delivery)
Mar 26 06:22:17 corporatepixels sendmail[23985]: s2Q6MEq1023983: to=<[email protected]>, ctladdr=<[email protected]> (498/498), delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=121375, relay=smtp.secureserver.net. [72.167.238.201], dsn=2.0.0, stat=Sent (ok:  Message 350408018 accepted)
Mar 26 06:32:59 corporatepixels sendmail[24455]: s2Q6WuiQ024455: from=mrinal, size=0, class=0, nrcpts=0, relay=mrinal@localhost
Mar 26 06:33:12 corporatepixels sendmail[24457]: s2Q6X8PV024457: from=mrinal, size=0, class=0, nrcpts=1, relay=mrinal@localhost

这是从 /var/log/maillog 中提取的

现在我真的不明白它们是否代表错误或成功传递,但邮件从未到达邮箱。

这是我的 /etc/hosts 文件中的内容

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.241.188.154 www.myprimarydomain.com myprimarydomain.com

答案1

dsn=5.0.0, stat=Service unavailable

这是一般错误。日志中还指出您的消息已转发至 root@localhost,因此请检查其邮箱以获取更多信息。

我认为您的问题在于您将 localhost 设置为主机名。将其设置为正常:

  1. 将服务器的主机名从 localhost 更改为 FQDN 主机名;
  2. 更新/etc/hosts并添加127.0.0.1 newhostname

相关内容