【问题标题】:mail header issue in sendmail in CentOs 6CentOs 6 中 sendmail 中的邮件标头问题
【发布时间】:2012-10-21 16:48:38
【问题描述】:

我在 rackspace 服务器上安装了 centOs 6,并安装了 Apache PHP 和其他模块。 我还安装了 sendmail 以使用 PHP 中的 mail() 函数,它可以工作,但我无法在 mail() 中设置自己的标题。

 $to = "myemail@gmail.com"; 
 $subject = "Hi!";
 $body = "Hi,\n\nHow are you?";


 $from = " Team <my@odomain.com>"; 
 $headers  = "From: $from\r\n"; 
 $headers = "MIME-Version: 1.0\n" ;
 $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";

 if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }

但是我收到了标题为“Apache apache@server”的垃圾邮件。标题未设置。 我也试过“-f emailaddress”,但没有用。

我该怎么办?我也尝试了一些 sendmail 配置,但仍然没有解决。

瑞特斯

【问题讨论】:

    标签: email header sendmail


    【解决方案1】:

    $headers = "From: $from\r\n"; 行中将\r\n 替换为\n

    【讨论】:

      猜你喜欢
      • 2016-05-11
      • 2014-02-28
      • 1970-01-01
      • 2016-05-07
      • 1970-01-01
      • 2011-07-01
      • 2011-01-02
      • 1970-01-01
      • 2011-05-19
      相关资源
      最近更新 更多