-2

它没有添加以下标题信息,而是在 PHP 邮件中显示 HTML 标记。

    $headers  = "From: ".$name."<".$email.">\r\n";
    $headers .= "Reply To: ".$email."\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "X-Mailer: PHP v".phpversion()."\r\n";         
    $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Content-Transfer-Encoding: 8bit\r\n";

请帮我。

4

3 回答 3

1

尝试这个,

  $subject = 'Mail Subject';
  $message = 'Test';
  $headers = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n";
  $headers .= "X-Mailer: PHP \r\n";
  $headers .= 'From: ".$name."<".$email.">' . "\r\n";
  $headers .= 'Reply-To: ".$email."' . "\r\n";
  mail($to, $subject, $message, $headers);
于 2013-02-28T05:49:36.230 回答
0

我的邮件示例()

$header = "From: Backapp.ru <noreply@backapp.ru>\r\nContent-type: text/html; charset=utf-8";
于 2013-02-28T05:47:47.693 回答
0

mail()函数 with的基本用法headers是:

   <?php
    $to = "you@local.com";
    $subject = "My email test.";
    $message = "Hello";

    $headers = "From: myplace@local.com\r\n";
    $headers .= "Reply-To: myplace2@local.com\r\n";
    $headers .= "Return-Path: myplace@local.com\r\n";
    $headers .= "CC: sombodyelse@local.com\r\n";
    $headers .= "BCC: hidden@special.com\r\n";

    if ( mail($to,$subject,$message,$headers) ) {
       echo "The email has been sent!";
       } else {
       echo "The email has failed!";
       }
    ?>

您没有将您的输出发送给我们,所以我们不知道问题出在哪里。

于 2013-02-28T05:52:11.620 回答