我必须向一些人发送一份表格,我用谷歌脚本来完成。
我尝试使用以下代码将表单嵌入到电子邮件中:https://stackoverflow.com/a/23671529/4305236 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,
});
...
但当表单直接从谷歌表单界面发送时,它不会像谷歌那样发送表单。
Email sent by script;
The goal (Email sent by google form directly):
这个问题已经被问过here https://stackoverflow.com/questions/39882766/send-form-with-mailapp-after-fetching-html-embed-google-form-into-email-genera但没有任何回应。
最后,目标是每天更改表单,因此不可能在以前发送的电子邮件中使用模板。
预先感谢您的帮助。
当 Google 直接将表单发送给人们并将表单嵌入到电子邮件中时,他们正在使用名为 AMP 的新产品。你可以在这里读更多关于它的内容:
- https://developers.google.com/amp/ https://developers.google.com/amp/
- https://www.blog.google/products/g-suite/bringing-power-amp-gmail/ https://www.blog.google/products/g-suite/bringing-power-amp-gmail/
- https://developers.google.com/gmail/ampemail/ https://developers.google.com/gmail/ampemail/
您使用的代码获取表单的原始 HTML,因为它将在浏览器中为用户呈现。此代码不是 AMP 格式。因此它不会做你想做的事。
如果您想要 AMP 体验,您需要自己创建 AMP 电子邮件。
我不认为FormApp https://developers.google.com/apps-script/reference/forms/有一种编程方式将表格发送给人们,就像您可以从https://docs.google.com/forms/ https://docs.google.com/forms/.
我希望这有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)