使用 phpmailer 处理退回邮件
我有一个使用 phpmailer 发送电子邮件的网页。我将主机设置为“relay-hosting.secureserver.net”,邮件->发件人、邮件->发件人和邮件->addReplyTo全部发送到同一地址,这是我希望发送退回电子邮件通知的地址到。该电子邮件地址也与同一主机和 smtp 主机相同。当我输入错误的电子邮件地址时,我不会收到未送达的通知。我做错了什么?谢谢
I have a webpage that sends out emails using phpmailer. I set the host to 'relay-hosting.secureserver.net' the mail->sender, mail->from and mail->addReplyTo all to the same address, which is the address that I want the bounced email notifications sent to. This email address in also with the same host and the smtp host. When I put in a bad email address I don't get a notification that is was not delivered. What am I doing wrong? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PHPmailer 不处理接收电子邮件。它纯粹是一个允许 PHP 与 SMTP 服务器通信以发送电子邮件的库。它绝对不支持充当邮件客户端(例如接收)。
PHPmailer 无法知道电子邮件被退回,因为退回是在 PHPmailer 将电子邮件交给外发 SMTP 服务器很久之后发生的。在现实世界中,PHPmailer 会收到您的信件,然后沿着街区将其放入邮箱中。退回邮件发生在稍后,当信件承运人将信件带回并盖上“返回发件人”印记时 - PHPmailer 根本不参与此过程。
您的选择是:
1) 使用 PHP 的 imap 函数连接到现有的 pop/imap 服务器并以这种方式检索电子邮件
2) 在 SMTP 端使用
.forward
或类似的重定向将传入电子邮件“发送”到 PHP 脚本。PHPmailer does not handle receiving emails. It's purely a library for allowing PHP to talk to an SMTP server for sending emails. It has absolutely no support whatsoever to act as a mail client (e.g. receiving).
PHPmailer has no way of knowing the email bounced, as the bounce occurs LONG after PHPmailer's handed the email off to the outgoing SMTP server. IN real world terms, PHPmailer takes your letter and walks down the block to drop it into a mailbox. The bounce occurs later, when the letter carrier brings the letter back with 'return to sender' stamped on it - PHPmailer is not involved in this at all.
Your options are:
1) Use PHP's imap functions to connect to an existing pop/imap server and retrieve emails that way
2) Use a
.forward
or similar redirect on the SMTP side to "send" incoming email to a PHP script.我知道这是一个古老且已回答的问题,但对于那些稍后可能会发现这篇文章并遇到类似问题的人,您可以通过使用 smtp 邮件中继服务来解决此问题。例如,如果您使用 jangosmtp,您的 jangosmtp 控制面板中有一个选项可以对退回报告应发送到的地址进行硬编码,或者始终将退回报告发送到发件人地址。
I know this is an old and answered question, but for those who may find this post later with a similar problem you might be able to solve this by going to your smtp mail relay service. If for example you use jangosmtp there is an option in your jangosmtp control panel to either hard code the address to which bounce reports should be sent or to always send bounce reports to the From address.