电子邮件模板-目标特定的电子邮件客户端(gmail) [英] Email template - target specific email client (gmail)

查看:199
本文介绍了电子邮件模板-目标特定的电子邮件客户端(gmail)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建电子邮件模板,我想知道是否可以将特定电子邮件客户端(例如Gmail)定位为仅在使用特定客户端查看电子邮件时才显示内容。

I am building an email template and I am wondering if it is possible to target specific email clients (for example Gmail) to display content only when the email is viewed using those specific clients.

例如,是否有一种方法只能将其显示给使用gmail浏览的电子邮件?

For example, is there a way to display this only to email viewed in gmail?

<div class="gmailOnly">This text will be displayed in Gmail only</div>

谢谢!

推荐答案

目前可以定位Gmail和收件箱。您需要利用以下事实:在修改HTML到达渲染引擎之前就已经对其进行了修改(就像在大多数电子邮件客户端中一样),在这些电子邮件客户端中,邮件正文将以< u>开头。 / u> 标签。
这:

It's possible to target Gmail and Inbox for the moment. You need to take advantage of the fact that the HTML is modified before it would hit the rendering engine (as in most email clients) and in these email clients the message body will start with <u></u> tags. This:

   <!DOCTYPE html>
    <html><head>
    <style>
        u + .body .gmail{
            display:block !important;
        }
    </style>
    </head>
    <body class="body">
      <div class="gmail" style="display:none;">
        THIS IS GMAIL OR INBOX
      </div>
    </html>

将被转换为:

    <u></u>    
    <div class="m_-4764228206553811341body">
      <div class="m_-4764228206553811341gmail" style="display:none">
        THIS IS GMAIL OR INBOX
      </div>
      <div class="yj6qo"></div>
      <div class="adL"></div>
    </div>

< u> 标签是特定的收件箱和Gmail客户端。因此,原始模板中的 div 只会显示在这些客户端中。

The <u> tags are specific to Inbox and Gmail clients. The divs from the original template therefore will only show in those these clients.

这篇关于电子邮件模板-目标特定的电子邮件客户端(gmail)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆