По какой-то причине, когда я отправляю сообщение электронной почты, HTML по-прежнему отображается в виде обычного текста. Может кто-нибудь, пожалуйста, скажите мне, что я здесь делаю неправильно?
Вот код:
$to = $_SESSION['customer_email'];
$from = "[email protected]";
$subject = "Confirmation for Appointment on ".$_SESSION['display_date'];
$headers = "From: ".$from."\r\n";
$headers .= "Content-type: text/html; charseet=UTF-8;\r\n";
$headers .= "MIME-Version: 1.0;\r\n";
$message = "<p>Thank you".$_SESSION['firstname']." for booking online. Your appointment has been confirmed and is scheduled for <strong>".$_SESSION['display_date']."</strong> between the hours of <strong>".$_SESSION['display_time']."</strong>.</p><p> Please expect our crew to arrive between your two hour arrival window. You will receive a courtesy call when our crew is <span>15-30 minutes</span> away. A confirmation email has been sent to <strong>".$_SESSION['customer_email']."</strong>. </p><p> If you have any questions or need to make any changes to your appointment, please contact our office at <strong>1-800-333-1111</strong>. Thank you for choosing Us!
</p>";
if(mail($to, $subject, $message, $header ))
{
$msg = "Your message has been sent";
}
измените свой 'charseet' на
Content-Type: text/html; charset=ISO-8859-1\r\n
В настоящее время вы можете использовать UTF-8
Content-Type: text/html; charset=UTF-8\r\n
а также
if(mail($to, $subject, $message, $header))
в
if(mail($to, $subject, $message, $headers))
также mail
RETURN:
Возвращает TRUE, если почта была успешно принята к доставке, в противном случае FALSE. Важно отметить, что только потому, что почта была принята для доставки, это НЕ означает, что почта действительно достигнет предполагаемого адресата.
$headers .= "Content-type: text/html; charseet=UTF-8;\r\n";
должно быть
$headers .= "Content-type: text/html; charset=UTF-8;\r\n";
Два опечатка:
if(mail($to, $subject, $message, $header ))
должно быть
if(mail($to, $subject, $message, $headers ))
И в
$headers .= "Content-type: text/html; charseet=UTF-8;\r\n";