繁体   English   中英

用PHP发送电子邮件中的标题问题

[英]Issue with headers in sending emails in PHP

您好,我正在使用内置于php mail()中的PHP,并使用此函数s =发送电子邮件:

function sendEmail($to,$subject,$message){
   $header = 'From: noreply@xxxxx.com' . "\r\n" .
   'MIME-Version: 1.0' . "\r\n" .
   'Content-type: text/html' . "\r\n" ;
   $retval = mail ($to,$subject,$message,$header);
   if( $retval == true ){
      return true;
   }
   else{
       return false;
   }
}

此功能正在发送电子邮件,但我确实不是从我设置的“发件人”标题中接收邮件的:“ noreply@xxxxx.com”,而是从我的主机服务器收到的,例如:xxx@host205.hostmonster.com

为什么这不能按我的意愿工作?

谢谢

您要使用格式正确的“发件人”语句,如下所示:

 $header = 'From: <noreply@xxxxx.com>' . "\r\n" .

要么

 $header = 'From: "no reply" <noreply@xxxxx.com>' . "\r\n" .

另一个可能的方法可能是: php邮件“发件人”标头出现问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM