【发布时间】:2017-11-22 09:45:48
【问题描述】:
我正在尝试为此 html 电子邮件添加背景颜色。
我试过了
-
<script>内部带有 css 代码的标签 -
body标签中的bgcolor
-
还有一个 CSS 样式表
所有这些都不起作用。 我读过它可能是我将这些测试发送给的提供商 (gmail),但必须有办法。
我在一个单独的 .html 文件上测试的所有方法都已更改为我想要的。我只是无法在实际的电子邮件中得到它。我在 php 中使用 mail()。
$message = "
<html>
<head>
<title>Rate Your Experience</title>
</head>
<body bgcolor = '#0000FF'>
<center>
<p>
<h2>How well did '$recipient' do?</h2>
<h4>Vacancy Title: '$vac_title'</h4>
<h4>Vacancy ID: '$vac_id'</h4>
</P>
</center>
<center>
<table>
<tr>
<td><h3>we are built on sharing your review with other people who may also want to use this service.</h3></td>
</tr>
<tr>
<td><h3>Please take a minute to reflect on the level of service youve received.</h3></td>
</tr>
<tr>
<td><h3>Your review is public - to other employers registered with Ahoy Employ.</h3></td>
</tr>
<tr>
<td><h3>Should you have any concerns that you would prefer to share in private, please email us at info@website.ca and quote the Vacancy ID shown above.</h3></td>
</tr>
</table>
</center>
</body>
</html>
";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <webmaster@provider.ca>' . "\r\n";
mail($to,$subject,$message,$headers);
【问题讨论】:
-
您可以为 Example(
<body style="background-color:#0000FF";>) 编写内联式表单电子邮件 -
基本的内联 CSS 将满足您的需求。
标签: php html css html-email email