我使用PHP Mailer發送HTML郵件。但是,當我發送電子郵件下面的所有填充,邊距,div大小等消失(在Outlook中)。如果我看看我的Gmail帳戶,它看起來很好。在iPhone的郵件應用程序邊緣等也沒有了。通過phpmailer發送html
<div id="wrapper" style="width: 100%;">
<table width=600 style="margin:0 auto">
<tbody>
<tr>
<td>
<div id="Banner" style="
max-width: 640px;
margin: 0 auto;
min-height: 60px;
background-color: #75dcfc;
width: 100%;
">
<div class="center" style="margin: auto;text-align: center;">
<img src="logourl" alt="test" style="max-width: 450px;padding-top: 0px;width: 50%;">
</div>
</div>
<div id="box" style="max-width: 640px;width: 100%;background-color: white;color: #696969;border-style: solid;border-width: 0px;text-align: center;border-color: #d3d3d3;margin-left: auto;margin-right: auto;overflow: hidden;padding: 0px;border-style: solid;height: 500px">
<div id="personalmsg" style="width: 100%;text-align: center;font-size: 22px;margin-left: auto;margin-right: auto;max-width: 400px;padding: 0px;">
<p style="text-align: left;font-size: 17px;margin-top: 50px; color: #000;font-weight: normal;font-style: normal;">hello</p>
</div>
</div>
<h2 id="link" style="text-align: center;max-width: 640px;margin: 0 auto;background-color: #75dcfc;padding-top: 15px;padding-bottom: 15px;width: 100%;"><a href="website" style="color: #fff;text-decoration: none;">Visit us</a></h2>
</td>
</tr>
</tbody>
</table>
</div>
正如你所看到的我只使用內嵌的CSS。但是我沒有得到我做錯了什麼。也許它有助於顯示我如何發送電子郵件:
$mail = new PHPMailer;
$mail->setFrom('[email protected]');
$mail->addAddress($email);
$mail->Subject = "Your Email";
$mail->Body = $html;
$mail->isHTML(true);
try {
$mail->Send();
}
catch (Exception $e) {
}
雖然$ html是將HTML保存爲字符串。
我很感謝在正確的方向
確保您使用完整的HTML標記。在這裏並不是這種情況,至少不是你發佈的內容。和/或它可能是您的Outlook的本地問題。 –