使用 PHP 通过 SMTP 发送邮件时使用 Return-path
使用 PHP 通过已验证 SMTP 发送邮件时,有没有办法设置返回路径? 我希望退回邮件能够被“发件人”地址以外的其他电子邮件地址捕获。
我知道有一种方法可以使用“普通”PHP mail() 函数(通过在第 5 个参数中设置“-f”标志)来执行此操作,但我不知道如何使用 SMTP 进行管理。
还尝试了 PEAR 的 Mail-package,但在标头中设置 Return-path 并没有完成这项工作。
Is there a way to set the Return-path when sending mail through authenticated SMTP using PHP?
I want bounce mails to be caught by another e-mail address than the "from" address.
I know that there is a way to do this with the "normal" PHP mail() function (by setting the "-f" flag in the 5th parameter), but I have no clue how to manage this with SMTP.
Also tried PEAR's Mail-package, but setting Return-path in the headers didn't do the job.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将第四个
mail()
参数 (additional_headers
) 设置为"Return-path:[电子邮件受保护]"
。示例:
您可以看到使用
\r\n
(换行符)分隔多个additional_headers
。另请参阅:http://php.net/manual/en/function.mail.php< /a>
Set the fourth
mail()
-parameter (additional_headers
) to"Return-path:[email protected]"
.Example:
You can see that you separate multiple
additional_headers
with\r\n
(newlines).See also: http://php.net/manual/en/function.mail.php
这就是你需要做的。
您需要将标头中的“返回路径”设置为要用作退回电子邮件的电子邮件。这对我有用。
例如 :
Here's what you need to do.
You need to set 'Return-Path' in the Headers to the email you want to use as your bounce email. This worked for me.
For example :