如何确保通过电子邮件发送的html文档中的Google Drive链接不会被识别为附件

How to ensure Google Drive links in an html document sent via email are not recognized as attachments?

本文关键字:链接 Drive Google 识别 文档 html 确保 何确保 电子邮件      更新时间:2023-09-26

我正在使用应用程序脚本以html格式呈现一封电子邮件,其中包含href属性链接到Google Drive文档的标记。

应用程序脚本的性能如预期,但当我打开在Gmail中发送的电子邮件时,所有链接的Google Drive文档都显示为电子邮件上的附件。

如何删除该功能?

当前使用以下MailApp方法:

MailApp.sendEmail({
    to: emailAddresses,
    noReply: true,
    subject: subject,
    htmlBody: htmlStr,
});

编辑:

一个不太理想的解决方案是通过像谷歌这样的url缩短器来运行各种谷歌驱动文档链接

尽管这确实完成了任务,因为识别谷歌驱动文档链接的默认gmail进程现在不再能够解析谷歌驱动文档连接,但我更希望能够提供一些头部上下文,通知上述默认gmail过程不要将谷歌驱动文档连接解析为附件。

我尝试用Html脚本发送一封电子邮件,如下所示:

<html>
  <head>
  </head>
  <body>
  <a href="https://docs.google.com/spreadsheets/d/1234546789123456789/edit#gid=0">link</a>
    <p>
      This a test for a Go-To action in Gmail.

    </p>
  </body>
</html>

它起了作用,并将其显示为href,但不是附件。希望能有所帮助!