阻止Gmail添加地址链接?

时间:2017-09-21 10:47:13

标签: html gmail html-email

我创建了一个包含一些地址信息的HTML电子邮件,在我的测试中,我注意到在Gmail.com中,该电子邮件会自动创建指向Google地图的地址的链接。

有没有办法可以通过某种方式使用标记来防止这种情况?

2 个答案:

答案 0 :(得分:4)

解决方案是将Gmail打败并将地址包装在您自己的<a>标记中,并更改样式以匹配普通文本。

e.g。 123伦敦假街应该是<a href="" style="text-decoration:none !important">123 Fake Street</a>

答案 1 :(得分:2)

我遇到一个问题,就是gmail和其他浏览器(例如IOS)想要使用电子邮件地址,街道地址或电话号码,并用蓝色下划线,这不符合我的品牌指南或使用电子邮件的整体设计。我理解你特别询问地址,我认为这也有助于解决类似的问题。

我采取了几个步骤来阻止数据检测器改进我的电子邮件。

在标题中,我添加了这个:

<meta name="format-detection" content="email=no" />
<meta name="format-detection" content="telephone=no" />

在样式表中,我添加了一些针对数据检测器的特定代码:

*[x-apple-data-detectors], .x-gmail-data-detectors, .x-gmail-data-detectors *, .aBn {
    border-bottom: 0 !important;
    cursor: default !important;
    color: inherit !important;
    text-decoration: none !important;
    font-size: inherit !important;
    font-family: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
}

最后,在地址本身中,我添加了非打印字符,如&zwnj;。这些字符不会显示在最终产品中,但它们有助于阻止Outlook或Gmail或IOS认为它需要强调的内容。像这样:

1313&zwnj; Mockingbird Lane
Mockingbird Heights, CA &zwnj;91608

然后,再次使用每个数据检测器并设置其输出样式以匹配电子邮件也不是一件坏事。这可能需要更长时间,但是您提到的任何日期都会链接到日历,电话号码会起作用,地址会显示在地图上。

祝你好运。