2013-03-21 3 views
1

최근 Plesk Parallel Linux Server로 업그레이드했으며 PHP 설정이 헤더를 무시하는 것처럼 보입니다! 전자 메일은 정상적으로 수신되지만 HTML 태그를 표시합니다. https://www.pressgofer.com/phpInfo.phpPHP mail() HTML을 표시하지 않습니다

PHP의 자체는 괜찮을해야하지만, 어쨌든 여기에 포함했다 :

phpInfo() 파일은 여기에서 볼 수 있습니다.

PHP 메일 코드

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

$headers = "From: [email protected] \r\n"; 
$headers .= "Reply-To: [email protected] \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); 

많은 감사, 닉

+0

메시지 앞에'mime'과'content-type'을 사용해보십시오. –

+2

phpinfo가 mail.add_x_header가 OFF임을 보여줍니다. 당신은 그것을 켜야합니다. –

+0

@Renku는 아무런 차이가 없다. 두 변수는 동시에 mail() 함수에 전달된다. 그래도 고마워. –

답변

2

당신의 phpinfomail.add_x_header이 꺼져 있는지 보여줍니다. 당신이 X-Mail 헤더를 사용하려면

에 그것을 설정해야합니다, 당신의 php.ini

<?php 
$to = "[email protected]"; 
$subject = "My HTML email test."; 
$headers = "From: [email protected]\r\n"; 
$headers .= "Reply-To: [email protected]\r\n"; 
$headers .= "Return-Path: [email protected]\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!"; 
    } 
?> 
+0

많은 감사. 지금 이것을 시도 할 것입니다. –

+0

@Nick 가격 : 저의 기쁨 –

+0

예. php.ini 파일에 권한 문제가있을 수 있습니다. 파일을 바탕 화면에 복사 한 다음 "mail.add_x_header"라는 단어를 찾으려고 액세스하십시오. –

관련 문제