PHP HTML 发送带有标签的电子邮件
PHP HTML email gets sent with tags
$to = 'jay@mywhitecard.ph';
$subject = 'Coupon Claimed!';
$header = 'From: info@mywhitecard.ph';
$claimed = '<html><body>';
$claimed .= '<h1>Hello, World!</h1>';
$claimed .= '</body></html>';
mail($to, $subject, $claimed, $header);
我有这封简单的 html php 电子邮件,但是当它发送时,包括标签在内的所有内容都会被包含在内。
google 教程显示了与我所做的代码类似的示例,想知道我如何只能发送 div 内容。
您需要像这样将 Content-type 添加到您的 header:
$to = 'jay@mywhitecard.ph';
$subject = 'Coupon Claimed!';
$claimed = '<html><body>';
$claimed .= '<h1>Hello, World!</h1>';
$claimed .= '</body></html>';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: info@mywhitecard.ph\r\n';
mail($to, $subject, $claimed, $headers);
$to = 'jay@mywhitecard.ph';
$subject = 'Coupon Claimed!';
$header = 'From: info@mywhitecard.ph';
$claimed = '<html><body>';
$claimed .= '<h1>Hello, World!</h1>';
$claimed .= '</body></html>';
mail($to, $subject, $claimed, $header);
我有这封简单的 html php 电子邮件,但是当它发送时,包括标签在内的所有内容都会被包含在内。
google 教程显示了与我所做的代码类似的示例,想知道我如何只能发送 div 内容。
您需要像这样将 Content-type 添加到您的 header:
$to = 'jay@mywhitecard.ph';
$subject = 'Coupon Claimed!';
$claimed = '<html><body>';
$claimed .= '<h1>Hello, World!</h1>';
$claimed .= '</body></html>';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: info@mywhitecard.ph\r\n';
mail($to, $subject, $claimed, $headers);