我試圖給這個html郵件添加背景顏色。如何添加背景顏色到用PHP郵件發送的html郵件()
伊夫試圖把在
<script>
標籤與CSS代碼中- 的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 [email protected] 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: <[email protected].ca>' . "\r\n";
mail($to,$subject,$message,$headers);
您可以編寫內聯格式的電子郵件例如('
') –基本的內嵌CSS將完成您所需的操作。 –