如何在mail()函数中将from属性更改为我的电子邮件


how to change the from attribute to my email in mail() function

当我的客户在我的网站上下单时,我正试图向他们发送电子邮件。但是from看起来是这样的:发件人:n9da2313我需要和info@awraq.me我试过了,但没用`

            $to = "founder@awraq.me";
            $subject = "Your order";
            $message = "Your order was placed successfuly";
            $headers = "From: info@awraq.me";
            $headers .= "'r'nReply-To: info@awraq.me";
            $headers .= "'r'nX-Mailer: PHP/".phpversion();
            mail($to,$subject,$message,$headers,"-f info@awraq.me");
        `

试试这个-

$to = "somebody@example.com, somebodyelse@example.com";
$subject = "HTML email";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "'r'n";
$headers .= "Content-type:text/html;charset=UTF-8" . "'r'n";
// More headers
$headers .= 'From: <webmaster@example.com>' . "'r'n";
$headers .= 'Cc: myboss@example.com' . "'r'n";
mail($to,$subject,$message,$headers);

如果它不起作用,请检查您是否在php.ini文件中进行了一些配置。