【发布时间】:2017-05-06 14:43:04
【问题描述】:
我正在使用 Ruby on Rails 生成电子邮件。正如Email markup docs 中提到的,我修改了我的 (*.html.haml) 模板以包含 电子邮件标记 的架构。以下代码来自我的邮件模板:
%script{ type: "application/ld+json" }
{
"@context" : "http://schema.org",
"@type" : "FoodEstablishmentReservation",
"reservationNumber" : "#{reservation.id}",
...
}
我还将电子邮件的发件人和收件人修改为与here 中提到的相同的电子邮件 ID,以便在开发模式下测试架构。
当我在我的 Gmail 收件箱中收到电子邮件时,我没有看到任何与以前不同的内容。当我检查电子邮件的原始消息时,它显示:
Return-Path: <breezebhoewal@gmail.com>
...
Date: Wed, 21 Dec 2016 13:14:45 +0530
From: breezebhoewal@gmail.com
To: breezebhoewal@gmail.com
...
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="--==_mimepart_585a32ecf2d94_143673fd10d24128893014"; charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_585a32ecf2d94_143673fd10d24128893014
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
...
<script type=3D'application/ld+json'>
{
"@context" : "http://schema.org",
"@type" : "FoodEstablishmentReservation",
"reservationNumber" : "<reservation-id>",
...
}
</script>
...
现在,如果我在Email markup tester 中验证此<script> 标记内容,它会说“不存在结构化数据”,但只要我从<script> 标记中删除“3D”并使其成为<script type='application/ld+json'> ,它会为所有字段正确提取结构化数据。
所以,我无法弄清楚为什么这个额外的字符串“3D”会被添加到 HTML 中?是因为哈姆吗?还是 Gmail 呢?并且有什么我可以解决的问题来在开发环境中测试这个电子邮件标记。如果需要更多信息,请告诉我。
【问题讨论】:
-
它是一个电子邮件编码系统,它允许将非 ASCII 字符表示为 ASCII 用于电子邮件传输。这种编码称为“quoted-printable”,这就是为什么您的电子邮件中有 3D 值。如果你会检查这个相关的SO post,它讨论了一些避免这种情况的方法,比如将其更改为“Content-Transfer-Encoding”。希望这会有所帮助。
-
你找到解决方法了吗?
标签: html ruby-on-rails email google-schemas