在我的邮件客户端或Gmail中,发件人始终是apache @ hosting12
有什么办法解决这个问题吗?我试过像这样设置标题但没有成功.可以sombody请帮帮我?
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: <'$from'> \r\n";
$headers .= "Reply-To: <'$from'> \r\n";
$headers .= "Return-Path: <'$from'>\r\n";
$headers .= "X-Mailer: PHP \r\n";
Run Code Online (Sandbox Code Playgroud)
要么
$headers = "From: $from";
Run Code Online (Sandbox Code Playgroud)
我在法国论坛上找到答案. http://www.developpez.net/forums/d413965/php/outils/configuration-sendmail_path-sender/
您可以在邮件功能中添加第5个参数:
mail($mail_recipient, $subject, $message, $headers, '-f'.$mail_from);
Run Code Online (Sandbox Code Playgroud)
是'-f'+ mail_from强制系统将邮件作为mail_from发送.