PHPMailer和SMTP:邮件从远程服务器发送时从不显示,在本地计算机上正常工作

时间:2021-07-14 18:11:40

I have a script that uses PHPMailer to send out an email. The email is sent with a direct SMTP connection to a remote mail server. The problem is that while everything seems to be okay when I run the script on my local machine, when the script is run on our live site using the same remote SMTP server the email never gets through. What's curious is that it seems to have worked at one point in time and has semi-recently decided that it just wasn't going to work anymore.

我有一个使用PHPMailer发送电子邮件的脚本。电子邮件通过直接SMTP连接发送到远程邮件服务器。问题是,当我在本地计算机上运行脚本时,一切似乎都没问题,当脚本在我们的实时站点上使用相同的远程SMTP服务器运行时,电子邮件永远不会通过。令人好奇的是,它似乎已经在某个时间点起作用并且最近半决定它不再起作用了。

What potential points of failure are there? I do not have access to the SMTP server in question so I can't check its log files without submitting a support ticket, and although I was just given sudo access to the web server that is sending the email, I'm not quite sure what I'm looking for in terms of logfiles to go through, etc.

有哪些潜在的失败点?我无权访问相关的SMTP服务器,因此我无法在不提交支持服务单的情况下检查其日志文件,虽然我刚刚获得sudo访问发送电子邮件的Web服务器,但我不太确定我正在寻找的日志文件,等等。

FWIW, my local machine is running Ubuntu 8.10, and the remote machine is running Red Hat Enterprise Linux ES release 4 (Nahant Update 1), so there is a bit of a difference in versions, but all I'm really looking for is a few pointers on where I should be looking for problems.

FWIW,我的本地机器正在运行Ubuntu 8.10,而远程机器正在运行Red Hat Enterprise Linux ES版本4(Nahant Update 1),所以版本有点不同,但我真正想要的只是一个关于我应该在哪里寻找问题的几点建议。

3 个解决方案

#1


How about you log into your live site, try to open a raw session to the remote SMTP server, and attempt to send email using raw SMTP commands? Doing so will help narrow down the possible causes of the problem.

如何登录实时站点,尝试打开远程SMTP服务器的原始会话,并尝试使用原始SMTP命令发送电子邮件?这样做有助于缩小问题的可能原因。

#2


Is the remote machine behind a firewall? If it is, it might block the sending of e-mails. Or your SMTP server is disallowing access from the remote server.

远程机器是否在防火墙后面?如果是,它可能会阻止发送电子邮件。或者您的SMTP服务器禁止从远程服务器访问。

#3


  • Is the machine behind a firewall?
  • 机器是否在防火墙后面?

  • Is the SMTP server configured to block certain hosts, or to only allow certain hosts?
  • SMTP服务器是否配置为阻止某些主机,或仅允许某些主机?

  • Does the SMTP server require authentication for only certain networks?
  • SMTP服务器是否仅要求对特定网络进行身份验证?

You should look into debugging PHPMailer, it should be able to provide the raw SMTP requests and responses that you can look at to see if anything is going wrong.

您应该考虑调试PHPMailer,它应该能够提供您可以查看的原始SMTP请求和响应,以查看是否出现任何问题。

#1


How about you log into your live site, try to open a raw session to the remote SMTP server, and attempt to send email using raw SMTP commands? Doing so will help narrow down the possible causes of the problem.

如何登录实时站点,尝试打开远程SMTP服务器的原始会话,并尝试使用原始SMTP命令发送电子邮件?这样做有助于缩小问题的可能原因。

#2


Is the remote machine behind a firewall? If it is, it might block the sending of e-mails. Or your SMTP server is disallowing access from the remote server.

远程机器是否在防火墙后面?如果是,它可能会阻止发送电子邮件。或者您的SMTP服务器禁止从远程服务器访问。

#3


  • Is the machine behind a firewall?
  • 机器是否在防火墙后面?

  • Is the SMTP server configured to block certain hosts, or to only allow certain hosts?
  • SMTP服务器是否配置为阻止某些主机,或仅允许某些主机?

  • Does the SMTP server require authentication for only certain networks?
  • SMTP服务器是否仅要求对特定网络进行身份验证?

You should look into debugging PHPMailer, it should be able to provide the raw SMTP requests and responses that you can look at to see if anything is going wrong.

您应该考虑调试PHPMailer,它应该能够提供您可以查看的原始SMTP请求和响应,以查看是否出现任何问题。