gpt4 book ai didi

javascript - 获取 html 后使用 MailApp 发送表单。将 Google 表单嵌入到电子邮件中。生成的电子邮件仅包含文本

转载 作者:行者123 更新时间:2023-12-01 15:28:47 24 4
gpt4 key购买 nike

我想在电子邮件中嵌入 Google 表单并使用 MailApp 发送。我正在尝试使用在以下位置找到的代码:https://stackoverflow.com/a/23671529/4305236 :

var form = FormApp.create('New Form');
....
var url = form.getPublishedUrl();
var response = UrlFetchApp.fetch(url);
var htmlBody = HtmlService.createHtmlOutput(response).getContent();
MailApp.sendEmail({
to: email,
subject: subject,
htmlBody: htmlBody,
});
...

日志显示表单的所有 html。

但是,当我运行代码时,电子邮件看起来就像文本,底部有链接。但是,当我在电子邮件中“显示原始”时,表单的所有 html 似乎都在那里,就像在日志中一样......

非常感谢任何帮助。

生成的表单是什么样的,希望将其嵌入到电子邮件中:
What generated form looks like, want this to be embedded in email

他们得到的是:
What they are getting instead

最佳答案

在这里回答:https://stackoverflow.com/a/60749897/3383907 .

出于历史目的复制/粘贴:

When Google sends the form to folks directly and embeds the form in the email they are using their new offering called AMP. You can read more about it here:

The code you're using gets the raw HTML of the form as it would be rendered for a user in a browser. This code is not in AMP format. Ergo it will not do what you want.

If you want that AMP experience you will need to create the AMP email yourself.

I don't think FormApp has a programatic way to send the form to folks, like you can from https://docs.google.com/forms/.

I hope that helps.

关于javascript - 获取 html 后使用 MailApp 发送表单。将 Google 表单嵌入到电子邮件中。生成的电子邮件仅包含文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39882766/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com