如何使用 mail() 设置返回路径;

rab*_*ius 2 php

如何使用 php 设置“返回路径”?

我尝试过什么

        $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);
Run Code Online (Sandbox Code Playgroud)

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

tle*_*nss 5

对于 Windows返回路径:应该有效。在 Linux 上,您必须使用-f sendmail 选项。更多信息可以在这里找到http://php.net/manual/en/function.mail.php

mail($email,$subject,$addletter,$headers, "-fno_replay@test.com");
Run Code Online (Sandbox Code Playgroud)