如何使用mail()设置Return-Path;

时间:2013-06-18 12:02:22

标签: php

如何用php设置“Return-Path”?

我尝试了什么

        $subject = "title \"" . $row['title'] . "\"";
        $headers = "From: test <no_replay@test.com>\r\n";
        $headers .= "Return-Path: no_replay@test.com\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=UTF-8\r\n";

        mail($email,$subject,$addletter,$headers);

从gmail源代码我看到Return-Path: <apache@localhost.localdomain>

1 个答案:

答案 0 :(得分:4)

对于Windows Return-Path:应该有效。在Linux上,您必须使用 -f sendmail选项。更多信息可以在http://php.net/manual/en/function.mail.php

找到
mail($email,$subject,$addletter,$headers, "-fno_replay@test.com");