2

最近、Plesk Parallel Linux Server にアップグレードしましたが、PHP 設定がヘッダーを無視しているように見えます! メールは正常に受信されていますが、HTML タグが表示されます。

phpInfo()ファイルはこちらからご覧いただけます: https://www.pressgofer.com/phpInfo.php

PHP自体は問題ないはずですが、とにかくここに含めました。

PHPメールコード

$email = "example@example.com";
$message = "<h1 style='font-family:Helvetica,Arial;font-size:17px'>Your account has a password reset request</h1>";

$headers = "From: noreply@pressgofer.com \r\n";
$headers .= "Reply-To:  noreply@pressgofer.com \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

mail($email, "Reset password notification", $message, $headers);

どうもありがとう、ニック

4

2 に答える 2

2

オフになっているあなたのphpinfo番組。mail.add_x_headerあなたはそれをオンにする必要があります

X-Mailヘッダーを有効にするにmail.add_x_headerは、php.ini

<?php
$to = "yourplace@somewhere.com";
$subject = "My HTML email test.";
$headers = "From: sinha.ksaurabh@gmail.com\r\n";
$headers .= "Reply-To: sinha.ksaurabh@gmail.com\r\n";
$headers .= "Return-Path: sinha.ksaurabh@gmail.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$message = "<html><body>";
$message .= "<h1> This is a test </h1>";
$message .= "</body></html>";

if ( mail($to,$subject,$message,$headers) ) {
   echo "The email has been sent!";
   } else {
   echo "The email has failed!";
   }
?> 
于 2013-03-21T10:49:31.627 に答える
0

PHPからメールを送信:ヘッダーは本文として解釈されますか?

問題は MIME タイプとサーバーの解釈に関連していました -\r必要ありません。

于 2013-03-21T11:39:29.317 に答える