PHP电子邮件出现多个或格式错误的新行错误

时间:2015-07-18 07:12:07

标签: php email

我收到此错误Warning: mail() Multiple or Malformed new lines found in additional header ...我试过给$ message变量一个不同的变量名,但我没有做任何事情。

错误来自我在此发布的最后一行..

mail($to,$subject,$message,$headers);

完整代码

$to = $approved_email;
        $subject = 'There is a new user request to join the ';
        $message = '
        <html>
        <head>
            <title>New User Request</title>
        </head>
        <body>
            <p>Hi '.$approved_firstname.',</p><br>
            <p>Your  Account has been accepted. You have been added to the group. To sign in, click this link
            http://example.com . </p><br>
            <p>Thank you,</p>
            <p>Administration</p>
        </body>
        </html>
        ';

        $from = "user-requests@example.com";
        $Bcc = "user-requests-confirm@example.com";

        // To send HTML mail, the Content-type header must be set
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

        // Additional headers
        $headers .= 'To: ' .$to. "\r\n";
        $headers .= 'From: ' .$from. "\r\n";
        $headers .= 'Bcc: '.$Bcc. "\r\n";

        // Send the email
        mail($to,$subject,$message,$headers);

我在另一个文件中有类似的电子邮件,但它确实有效。可能是什么问题?

0 个答案:

没有答案