dongxian5735 2014-11-23 23:21
浏览 36
已采纳

phpmailer垃圾邮件过滤器的并发症“-f”

My clients hosting service isn't accepting emails sent from the website that doesn't have "-f" at the start of the FROM address. This related to a recent outgoing SPAM filter they added.

Official response is:

“senders envelope of data” is missing certain elements

I use phpmailer, everything was working fine until now using SMTP authentication.

But now with phpmailer, this DOESN'T work

$mail->From         = 'me@test.com';

Also doesn't work

$mail->From         = '-f me@test.com';

Its invalid obviousdly, not a good looking email address.

I CAN get mail to actually send like this:

mail('me@test.com', 'the subject', 'the message', null, '-f me@test.com');

But that isn't phpmailer, this is the garden variety php function. So im trying to make PHPmailer add "-f " to the FROM automatically somehow.

Should I be adjusting the class files to somehow get around that? Stuck!

  • 写回答

1条回答 默认 最新

  • doujiyuan0211 2014-11-24 05:01
    关注

    You've got your transports mixed up. -f in the mail() function is an additional parameter passed to the underlying sendmail binary that sets the envelope sender of the message (and officially it should not have a space after it, like -fme@test.com). However, it does not apply when you are sending via SMTP because you get control over that parameter with the Sender property. You should do this:

    $mail->Sender = 'me@test.com';
    

    If you send using SMTP it will use that as the envelope sender (as the content of the SMTP MAIL FROM command), and if you send via isMail() or isSendmail() transports, it will set the sender via the -f property.

    Also make sure you're using the latest PHPMailer from GitHub.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 angular开发过程中,想要读取模型文件,即图1的335行,会报404错误(如图2)。但我的springboot里配置了静态资源文件,如图3。且在该地址下我有模型文件如图4,请问该问题该如何解决呢?
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?
  • ¥15 讲解电路图,付费求解
  • ¥15 有偿请教计算电磁学的问题涉及到空间中时域UTD和FDTD算法结合的
  • ¥15 vite打包后,页面出现h.createElement is not a function,但本地运行正常
  • ¥15 Java,消息推送配置
  • ¥15 Java计划序号重编制功能,此功能会对所有序号重新排序,排序后不改变前后置关系。
  • ¥15 关于哈夫曼树应用得到一些问题