2012-05-03 3 views
1

PHPMailer와 SMTP를 사용하여 전자 메일을 보내고 있습니다. 제목에 &이있는 경우를 제외하고 모두 작동합니다.받은 편지함에 제목이 있습니다. &phpmailer & subject in &

이 문제가 발생하지 않도록하려면 어떻게해야합니까? 나는 charset을 설정하고 주제를 인코딩하려고 시도했다.

내 코드

$mail    = new PHPMailer(); 
$mail->IsSMTP(); // telling the class to use SMTP 
$mail->CharSet = 'UTF-8'; 
$mail->SMTPDebug = false; 
$mail->SMTPAuth = true;     // enable SMTP authentication 
$mail->SMTPSecure = "tls";     // sets the prefix to the servier 
$mail->Host  = "smtp.gmail.com";  // sets GMAIL as the SMTP server 
$mail->Port  = 587;     // set the SMTP port for the GMAIL server 
$mail->Username = "[email protected]"; // GMAIL username 
$mail->Password = "password";   // GMAIL password 
$mail->SetFrom('[email protected]', 'From Person'); 
$mail->AddReplyTo("[email protected]", "From Person"); 
$mail->Subject = 'An example with a & in the middle'; 
$mail->MsgHTML('Some text to send'); 
$mail->AddAddress('[email protected]'); 
$mail->Send() 

당신은

+0

저에게 PHPMailer의 버그처럼 보입니다. 받은 그대로 원시 메시지 자체를 게시 할 수 있습니까? – Brad

+0

원시 형식의 제목은 &입니다. 내 보낸 폴더의 메시지도 볼 수 있으며 &도 있습니다. – bones

답변

0

,이 코드를 사용해보십시오 도움이된다면 알려 주셔서 감사합니다 아래에 있습니다.

$mail->Subject = "=?UTF-8?B?".base64_encode($_POST['subject'])."?=";