简体   繁体   English

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

[英]phpmailer complications for spam filters “-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. 我的客户托管服务不接受从发件人地址开头不带“ -f”的网站发送的电子邮件。 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. 我使用phpmailer,直到现在使用SMTP身份验证为止一切正常。

But now with phpmailer, this DOESN'T work 但是现在使用phpmailer,这行不通

$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. 但这不是phpmailer,这是花园类的php函数。 So im trying to make PHPmailer add "-f " to the FROM automatically somehow. 因此,我试图使PHPmailer以某种方式自动将“ -f”添加到FROM中。

Should I be adjusting the class files to somehow get around that? 我应该调整类文件以某种方式解决该问题吗? Stuck! 卡住!

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 ). mail()函数中的-f是传递给基础sendmail二进制文件的附加参数,该参数设置消息的信封发件人(并且正式地,它后面不应有空格,例如-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. 但是,它不适用于通过SMTP发送的情况,因为您可以使用Sender属性控制该参数。 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. 如果使用SMTP发送,它将用作信封发件人(作为SMTP MAIL FROM命令的内容),如果通过isMail()isSendmail()传输发送,它将通过-f属性设置发件人。

Also make sure you're using the latest PHPMailer from GitHub. 还要确保您使用的是来自GitHub的最新PHPMailer。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM