Php 如何将from属性更改为my email in mail()函数

Php 如何将from属性更改为my email in mail()函数,php,function,email,Php,Function,Email,当我的客户在我的网站上下订单时,我试图向他们发送电子邮件。但“来源”看起来是这样的: 发件人:n9da2313 我需要和你交换info@awraq.me 我试过了,但没用 ` 试试这个- $to = "somebody@example.com, somebodyelse@example.com"; $subject = "HTML email"; // Always set content-type when sending HTML email $headers = "MIME-Version

当我的客户在我的网站上下订单时,我试图向他们发送电子邮件。但“来源”看起来是这样的: 发件人:n9da2313 我需要和你交换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);
$to=”somebody@example.com, somebodyelse@example.com";
$subject=“HTML电子邮件”;
//发送HTML电子邮件时始终设置内容类型
$headers=“MIME版本:1.0”。“\r\n”;
$headers.=“内容类型:text/html;字符集=UTF-8”。“\r\n”;
//更多标题
$headers.='From:'。“\r\n”;
$headers.='Cc:myboss@example.com' . “\r\n”;
邮件($to、$subject、$message、$headers);

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

根据您的邮件系统,当您将电子邮件添加为联系人时,它只显示您定义的姓名。您是否尝试过将
founder@awraq.me
或另一封邮件作为发件人进行检查?是的,我尝试过这样做。它不起作用。php.ini中的哪种配置会导致这种情况?
$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);