我使用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的本地问题。 –