简体   繁体   English

PHP Sendmail返回路径问题

[英]PHP Sendmail Return Path issue

I am running into a problem with zend mail sending functionality. 我遇到了zend邮件发送功能的问题。

I have a functionality where we have set up some cron jobs and those cron jobs processes some php script and then sends a mail. 我有一个功能,我们在其中设置了一些cron作业,这些cron作业处理了一些php脚本,然后发送了一封邮件。 Actually mails are going fine, but sometimes it is getting dropped into spam directory. 实际上,邮件运行良好,但有时会掉入垃圾邮件目录。 After some research I have found that the return-path of mail body is causing problem. 经过一些研究,我发现邮件正文的返回路径引起了问题。 Since the mail sending script us as a root, so the return-path is root@domain.com and I want change it to support@domain.com 由于邮件发送脚本是我们的根用户,所以返回路径是root@domain.com,我想将其更改为support@domain.com

Is there any way I can achieve that. 有什么办法可以实现这一目标。

Note: I did try to add that in headers, but it is not working. 注意:我确实尝试将其添加到标题中,但是它不起作用。

It's return-path not reply-to... There's no such thing as reply-path :) 这是返回路径而不是回复...没有回复路径:)

There are lots of parameters for being marked as spam and I'm not sure it's because of return-path only. 有很多参数被标记为垃圾邮件,我不确定这仅是由于return-path造成的。 You have to fix it though and you can try by altering the headers while sending: 不过,您必须对其进行修复,并且可以尝试在发送时更改标头:

    $mail = new Zend_Mail();
    $mail->addTo($this->email, $this->name)
        ->setFrom($message->from_email, $message->from_name)
        ->setSubject($message->subject)
        ->setBodyHtml($message->getHtmlEmailContent($subscriber))
        ->setBodyText($message->getTextEmailContent($subscriber))
        ->setReturnPath($settings->get('return_path'))

However SMTP servers might override this (gmail definitely does). 但是,SMTP服务器可能会覆盖此设置(gmail确实可以)。 Just open the email in raw and see if your header is there and if it's overriden or not. 只需以原始格式打开电子邮件,然后查看标题是否存在以及是否被覆盖。

If mails are marked as spam in your test account randomly you might want to check the contents and subject of your email. 如果您的测试帐户中随机将邮件标记为垃圾邮件,则您可能需要检查电子邮件的内容和主题。 SPF records for your SMTP domain is important too. SMTP域的SPF记录也很重要。

See https://www.campaignmonitor.com/blog/post/1971/what-are-some-good-methods-for and http://mailchimp.com/resources/guides/how-to-avoid-spam-filters/ for some details. 参见https://www.campaignmonitor.com/blog/post/1971/what-are-some-good-methods-forhttp://mailchimp.com/resources/guides/how-to-avoid-spam-filters /了解更多信息。

See this answer for the explanation of reply-to and return-path. 有关答复和返回路径的说明,请参见此答案

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

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