5

我正在尝试测试 Gmail 处理 HTML 邮件中嵌入的 JSON-LD 的能力,以便在收件箱视图中显示相关操作,此处描述了该操作的介绍。我已经向自己发送了一条消息(使用 Python API),我希望 Gmail 会为此呈现我的视图操作,此处显示了一个示例。然而,什么都没有发生。我希望看到“查看文件”的链接,类似于为航班预订等显示的链接。

我试图了解我的特定 JSON-LD 内容是否存在问题,或者我是否正在尝试做一些不受支持的事情。嵌入在 中的相关 JSON-LD 段<body>是:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "CreativeWork",
  "@id": "http://my-site.com/file/1",
  "additionalType": "http://www.productontology.org/id/Computer_file",
  "name": "My File",
  "description": "View this file",
  "url": "http://my-site.com/file/1",
  "action": {
    "@type": "ViewAction",
    "url": "http://my-site.com/file/1",
    "name": "View File"
  }
}
</script>

如果电子邮件的编码方式有问题,这里是原始格式(个人信息已编辑)

Received: from 874510238733-ktbae5ftk223du75th86q0uua7i7rp5v.apps.googleusercontent.com
    named unknown
    by gmailapi.google.com
    with HTTPREST;
    Fri, 6 Mar 2015 14:54:52 -0800
Content-Type: multipart/alternative;
 boundary="===============5111695568485418487=="
MIME-Version: 1.0
to: ****@gmail.com
subject: A file has been shared to your email
Date: Fri, 6 Mar 2015 14:54:52 -0800
Message-Id: <CADTCK+Vyd-bKWBJXMcs8eS1zQ-b34BanFzNKOBMVf_2dBiPB3A@mail.gmail.com>
From: ****@gmail.com

--===============5111695568485418487==
Content-Type: text/text; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit


A new file is available.  View this file <http://my-site.com/file/1>

--===============5111695568485418487==
Content-Type: text/html; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

<html>
<body>

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "CreativeWork",
  "@id": "http://my-site.com/file/1",
  "additionalType": "http://www.productontology.org/id/Computer_file",
  "name": "My File",
  "description": "View this file",
  "url": "http://my-site.com/file/1",
  "action": {
    "@type": "ViewAction",
    "url": "http://my-site.com/file/1",
    "name": "View File"
  }
}
</script>

<div>A new file is available.  <a href="http://my-site.com/file/1" target="_blank">View this file</a></div>

</body>
</html>

--===============5111695568485418487==--
4

0 回答 0