2011-08-31 4 views
3

PHP를 사용하여 다중/혼합 메시지 (일반 텍스트, HTML 및 첨부 파일)를 보냈습니다. 그러나 대부분의 계정에서 작동하는 반면 Yahoo, GMail 및 Sky는 빈 이메일을 표시합니다. 다른 모든 것들이 이메일을 표시하는 것처럼 보입니다. 어떠한 도움도 대대적으로 승인 될 것입니다!공백 멀티 파트 전자 메일

내 헤더는

$headers .= "Content-Type: multipart/mixed; boundary=\"mixed-" . $random_hash . "-mixed\"\n"; 
$headers .= "MIME-Version: 1.0\n"; 

하고 내용이다;

--mixed-7df05b31-mixed 

Content-Type: multipart/alternative; boundary="alt-7df05b31-alt" 

--alt-7df05b31-alt 

Content-Type: text/plain; charset=utf-8 

      Hello how are you? I am just checking the mailing function. 

      Hopefully this will work! 

      Cheers. 

--alt-7df05b31-alt 

Content-Type: text/html; charset=utf-8 

<div style="font-family:Arial, Helvetica, sans-serif; font-size: 10pt;"> 

<div> 


      Hello how are you? I am just <b>checking</b> the mailing function.<br><br> 


      Hopefully this will work!<br><br> 


      Cheers.</div></div> 

--alt-7df05b31-alt-- 

--mixed-7df05b31-mixed 

Content-Type: text/plain; name="abc.txt" 
Content-Disposition: attachment; filename="abc.txt" 
Content-Transfer-Encoding: base64 

SEVMTE8gSlVTVCBURVNUSU5HIC4uLiA= 

--mixed-7df05b31-mixed-- 

답변

0

고유 한 MIME 메시지를 작성하지 마십시오. Swiftmailer 또는 PHPMailer을 사용하십시오.

+3

빌링 자체 컴파일 MIME 메시지의 잘못된 점은 무엇입니까? –

+0

분명히 잘못된 것을하고 있기 때문입니다. 귀하의 이메일이 제대로 구성 되었다면 문제없이 gmail/yahoo에 표시 될 것입니다. PHPMailer가 읽는 위치에 관계없이 모든 프로젝트에서 기형의 메시지를 보게됩니다. –

+0

PHPMailer가 작동하는 것 같습니다. –

2

붙여 넣기에서 아티팩트 일 수 있지만 각 경계의 끝에서 공백을 제거하십시오. 텍스트를 강조 표시하면 경계에 추가 공간이 있지만 닫는 경계가 있음을 알 수 있습니다.

2

다음 코드가 정상적으로 작동하므로 코드가 다음과 같은지 확인하십시오.

$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; 
$headers .= "This is a multi-part message in MIME format.\r\n"; 
$headers .= "--".$uid."\r\n"; 
$headers .= "Content-type:text/html; charset=iso-8859-1\r\n"; 
$headers .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; 
$headers .= $msg."\r\n\r\n";  
$headers .= "--".$uid."\r\n"; 
$headers .= "Content-Type:application/html; name=\"".$filename."\" \r\n"; // use different content types here 
$headers .= "Content-Transfer-Encoding: base64\r\n"; 
$headers .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n"; 
$headers .= $content."\r\n\r\n"; 
$headers .= "--".$uid."--"; 
관련 문제