如何设置自定义字体以在邮件中显示文本

How to set custom fonts to display text in Mails

我正在核心 php 中编辑一个 Mailer 模板。然而,我想要实现的是,我想为邮件模板中显示的文本设置自定义字体,就像我们使用 CSS 和导入字体将其设置为任何网站一样。

以下是我正在使用的代码。

<link href=\"https://fonts.googleapis.com/css?family=Cairo\" rel=\"stylesheet\">
                  <style type=\"text/css\">

body {
       -webkit-font-smoothing: antialiased;
       -webkit-text-size-adjust: none;
       width: 100% !important;
       margin: 0 !important;
       height: 100%;
       color: #676767;
       font-family: 'Cairo', sans-serif !important;
     }

<td class=\"header-lg\" style=\"font-family: 'Cairo', sans-serif !important; font-weight: 500;\">
    Just One More Step To Go...
</td>

但即使在我将演示邮件发送到收件箱时应用了这些东西,它仍然是 Gmail 应用程序、浏览器电子邮件和其他邮件服务使用的默认字体。

任何人都可以建议如何让它工作吗?

这里有两篇文章 Campaign Monitor - web font support from Campaign Monitor (updated 2015) and Litmus - using web fonts in email Litmus(2017 年 9 月发布)详细介绍了邮件应用中的网络字体支持。遗憾的是,GMail 网页版或应用程序不支持。