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。= "コンテンツタイプ:text/plain; charset = charset = us-ascii \ n"; \t $ body。= "コンテンツ転送エンコーディング:7ビット\ n \ n"; \t $ body。= $ text_content; \t $ body。= "\ n \ n"; \t $ body。= " - {$ mime_boundary} - \ n"; \t \t \t $ body。= " - {$ mime_boundary} - \ n"; $ body。= "コンテンツタイプ:text/html; charset = iso-8859- \ n"; \t $ body。= "コンテンツ転送エンコーディング:7ビット\ n \ n"; \t $ body。= $ html_content; \t $ body。= "\ n \ n"; \t $ body = " - {$ mime_boundary} \ n"; ' – acctman
他の方法では、$ body = " - {$ mime_boundary}で始まります。 $ body。= " - {$ mime_boundary} - \ n"で終了します。 –