1
我的html電子郵件welcome.tpl文件格式更正我使用PutsMail進行了測試,它下面的代碼處理併發送電子郵件,但HTML未呈現。我得到的是電子郵件中實際的html源代碼。HTML電子郵件發送時不呈現
$mime_boundary = 'Multipart_Boundary_x'.md5(time()).'x';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers.= "Content-Type: multipart/alternative; boundary=" .$mime_boundary. "\r\n";
$headers.= "Content-Transfer-Encoding: 7bit\r\n";
$headers.= "From: <[email protected]>" . "\r\n";
$headers.= "X-Sender-IP: $_SERVER[SERVER_ADDR]" . "\r\n";
$headers.= "Date: ".date('n/d/Y g:i A') . "\r\n";
$headers.= "Reply-To: my" . "\r\n";
$subject='New Reg';
$body.= "{$mime_boundary}\n";
$body.= "Content-Type: text/html; charset=iso-8859-2\n";
$body.= "Content-Transfer-Encoding: 7bit\n\n";
$body.= $html_content;
$body.= "\n\n";
$body.= "--{$mime_boundary}\n";
$html_content = file_get_contents('emails/welcome.tpl');
$body = str_replace("{Username}",$en['user'],$html_content);
mail($en['email'], $subject, $body, $headers);
這是正確的嗎? '$ body =「 - {$ mime_boundary} - \ n」; \t $ body。=「Content-Type:text/plain; charset = charset = us-ascii \ n」; \t $ body。=「Content-Transfer-Encoding:7bit \ n \ n」; \t $ body。= $ text_content; \t $ body。=「\ n \ n」; \t $ body。=「 - {$ mime_boundary} - \ n」; \t \t \t $ body。=「 - {$ mime_boundary} - \ n」; $ body。=「Content-Type:text/html; charset = iso-8859- \ n」; \t $ body。=「Content-Transfer-Encoding:7bit \ n \ n」; \t $ body。= $ html_content; \t $ body。=「\ n \ n」; \t $ body。=「 - {$ mime_boundary} \ n」;' – acctman 2011-12-20 21:15:16
其他方式:以$ body =「 - {$ mime_boundary}開始\ n」;以$ body結尾。=「 - {$ mime_boundary} - \ n」; – 2011-12-20 21:31:59