我正在使用PHPMailer发送电子邮件,但是发送时CSS形式的某些方面不会进入Mail:
有谁能告诉我为什么这些CSS不能进入已发送的电子邮件表单,而其他所有CSS加载都没有问题?
如果我在控制台中输入这些值,它们将起作用,所以我不明白为什么在发送邮件时从DOM中删除这些CSS值。
这是我的代码:
<style>@import url("https://fonts.googleapis.com/css2?family=Thasadith:ital,wght@0,400;0,700;1,400;1,700&display=swap");</style>
<div style="background-color: #ffffff; margin: auto; width: 65%; border: 1px solid #e1e1e1; outline: 1px solid #e1e1e1; outline-offset: 5px; margin-top: 25px; margin-bottom: 25px;padding: 5px;">
<div style="display: flex; justify-content: center; align-items: center; background-color: #f35653; margin-bottom: 20px; padding: 30px 0px;">
<div style="background-image: url(https://i.imgur.com/XPTHrId.png); background-position: center; background-size: cover; width: 50px; height: 50px;"></div>
<div style="font-size: 40px; text-transform: uppercase; align-self: center; color: white; font-family: Thasadith, sans-serif; font-weight: 700; margin-left: 5px;">Enkou Academy</div></div>
<div style="padding: 10px 40px 40px;font-size: 15px;">
<p>We received a request to reset the password for your Enkou Academy account.<br><br>
To reset the password, click on the link below:<br><br>
<a href="' . $url . '" style="text-decoration: none; color: #f35652;">Click here!</a><br><br>
If you didn't request a password reset, let us know.</p>
</div>
</div>'
电子邮件程序仅支持CSS的有限子集。请查看https://www.caniemail.com/。
Apple Mail和Gmail均支持Flex,但Outlooks,Yahoo,AOL https://www.caniemail.com/search/?s=flex不支持Flex 。这就是为什么我们仍然使用表格编写电子邮件的原因!
font-family
可以使用,但是如果您转到该网址(https://fonts.googleapis.com/css2?family=Thasadith:ital,wght@0,400;0,700;1,400;1,700&display=swap)并复制,则会获得更好的支持在@font-face
进入<style>
。即使那样,您的自定义字体也只会在Apple,Samsung和其他几个字体上显示:https : //www.caniemail.com/search/?s= font- face
例如这样写:
<style type="text/css">
@font-face {
font-family: 'Thasadith';
font-style: italic;
font-weight: 400;
font-display: swap;
src: local('Thasadith Italic'), local('Thasadith-Italic'), url(https://fonts.gstatic.com/s/thasadith/v3/mtG-4_1TIqPYrd_f5R1osnMX-CE.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
mso-font-alt: Arial;
}
</style>
请注意,添加了Outlook字体后备(mso-font-alt
)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句