2013-03-21 1 views
0

희망이 있기 때문에 기대를 모으고 있습니다.공백을 표시하는 PHP 다중 부분 텍스트/HTML

나는 이것을하기 위해 여러 가지 스크립트를 시도했지만 착륙 한 것은 이것이었다. 이 그림에 어떤 문제가 있습니까? 나는 전자 메일을 받지만 완전히 비어있다. 그러나 이메일의 출처에는 내용이 있습니다.

이메일 코드

//define receiver and subject 

    $to = '[email protected]'; 
    $subject = 'Test email'; 

//create boundary 

    $random_hash = md5(date('r', time())); 

//define the headers 

    $headers = "From: [email protected]\r\nReply-To: [email protected]"; 
    $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"$random_hash\""; 

//define the body of the message. 

    $message = "--$random_hash\n" . 
    "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . 
    "Content-Transfer-Encoding: 7bit\n\r" . 

    "Hello\n\rWorld!!!\n\r" . 

    "--$random_hash\n" . 
    "Content-Type: text/html; charset=\"iso-8859-1\"\n" . 
    "Content-Transfer-Encoding: 7bit\n\r" . 

    "<h2>Hello World!</h2>\n\r" . 

    "--$random_hash--"; 

//send the email 

    $mail_sent = mail($to, $subject, $message, $headers); 

가상 SOURCE는

Received: (qmail 26359 invoked by uid 48); 21 Mar 2013 10:09:01 -0700 
Date: 21 Mar 2013 10:09:01 -0700 
Message-ID: <[email protected]> 
To: [email protected] 
Subject: Test email 
X-PHP-Originating-Script: 10001:plug-send-direct.php 
From: [email protected] 
Reply-To: [email protected] 
Content-Type: multipart/alternative; boundary="f41fbfe6fda45eb7f5a2724ba135d292" 

--f41fbfe6fda45eb7f5a2724ba135d292 
Content-Type: text/plain; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit 


Hello 

World!!! 

--f41fbfe6fda45eb7f5a2724ba135d292 
Content-Type: text/html; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit 

<h2>Hello World!</h2> 

--f41fbfe6fda45eb7f5a2724ba135d292-- 

이 무엇 제공 (접수)?

답변

0

HTML이 "html", "head"및 "body"태그로 올바르게 구성되었는지 확인하십시오. 또한 제대로 닫혔는지 확인하십시오.

<html> 
<head> 
</head> 
    <body> 
    Stuff 
    </body> 
</html> 
관련 문제