返回路径被 Exim 覆盖?
我有一个带有 cPanel 的 VPS,我正在使用 PHPMailer 通过由 exim 运行的本地 SMTP 服务器发送电子邮件,问题是我实际上添加了:
$mail->AddCustomHeader('Return-Path: [email protected]');
但它被默认的覆盖了,我知道我可以做到这一点在 mail()
中使用 -f
第 5 个参数,但我想动态地使用 PHPMailer 来完成此操作。
感谢任何帮助。
谢谢
I have a VPS with cPanel and I'm using PHPMailer to send email through the local SMTP server which is run by exim, the problem is that I actually add:
$mail->AddCustomHeader('Return-Path: [email protected]');
But it's being overwritten with the default one, I know that I can do it with the -f
5th parameter in mail()
but I want to do it using PHPMailer dynamically..
Appreciating any help.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PHPMailer 类有一个
Sender
变量,它根据需要设置-f
参数(或在使用 SMTP 时构造适当的MAIL FROM:
命令)。从源代码来看:因此您大概可以执行以下操作:
传出邮件服务器往往会忽略 Return-Path,因为它们具有来自 SMTP
MAIL FROM:
行的地址。 Return-Path 标头由收件人的邮件服务器插入,用于过滤器或其他下游处理。The PHPMailer class has a
Sender
variable which sets the-f
parameter (or constructs the appropriateMAIL FROM:
command when using SMTP) as necessary. From the source code:so you can presumably do something like:
Outgoing mail servers tend to ignore Return-Path since they have the address from the SMTP
MAIL FROM:
line. The Return-Path header is inserted by the recipient's mail server for use in filters or other downstream processing.