1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > php 添加样式 添加样式到php html电子邮件

php 添加样式 添加样式到php html电子邮件

时间:2019-02-13 09:01:48

相关推荐

php 添加样式 添加样式到php html电子邮件

我仔细查看了这个问题,我在此发现的是添加以下内容:

$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);

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。