我仔细查看了这个问题,我在此发现的是添加以下内容:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
和
我想发送一个时事通讯类型的电子邮件,所以造型真的很重要.我观看的所有视频都只是制作html表格,所以我真的没那么做.我想在我的电子邮件中设置内容的样式.
我现在有这个:
$to = $newsletter_email;
$subject = 'Thank you for subscribing';
$message = '
#email-wrap {
background: #151515;
color: #FFF;
}
Hi,
Thank you.
Thank you,
Administration
';
$from = "newsletter@";
//$Bcc = "example@";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: ' .$to. "\r\n";
$headers .= 'From: ' .$from. "\r\n";
// $headers .= 'Bcc: '.$Bcc. "\r\n";
// Send the email
mail($to,$subject,$message,$headers);
我试过从这个消息变量中取出样式并将此文件转换为一个html样式的文件,在php之外:
Newsletter
#email-wrap {
background: #151515;
color: #FFF;
}
等等
电子邮件实际发送,但我无法弄清楚如何添加样式.我究竟做错了什么??
$email_from = "newsletter@";
$full_name = 'Company Name';
//$from_mail = $full_name.'';
$from = $from_mail;
//$from = "newsletter@";
//$Bcc = "example@";
// To send HTML mail, the Content-type header must be set
$headers .= "From: ".$full_name." \r\n";
and $headers .= "Return-Path: ".$full_name." \r\n";
/*$headers = "" .
"Reply-To:" . $from . "\r\n" .
"X-Mailer: PHP/" . phpversion();*/
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: ' .$to. "\r\n";
$headers .= 'From: ' .$from_email. "\r\n";
// $headers .= 'Bcc: '.$Bcc. "\r\n";
// Send the email
mail($to,$subject,$message,$headers);