[英]Embed Google Form in Gmail using Apps Script
I'm trying to use Apps script to embed a prefilled Form in an email.我正在尝试使用 Apps 脚本在电子邮件中嵌入预先填写的表单。 The emails will only be sent to Gmail users.
电子邮件只会发送给 Gmail 用户。 I want something that works the same as pressing the 'include form in email' option when manually emailing a form.
我想要一些与手动通过电子邮件发送表单时按“在电子邮件中包含表单”选项相同的功能。
I've successfully created the prefilledUrl
and used UrlFetchApp
and HtmlService
to get the Html from the form and send email.我已经成功地创建了
prefilledUrl
和使用UrlFetchApp
和HtmlService
从形式和发送电子邮件获得HTML。
But when it arrives it looks like the screenshot below and user can not submit.但是当它到达时,它看起来像下面的屏幕截图,用户无法提交。
A stripped down version of the code I am using is the following:我正在使用的代码的精简版本如下:
var prefilledForm = 'prefilledForm link here');
Logger.log(prefilledForm);
var subject = 'Message from Office';
var response = UrlFetchApp.fetch(prefilledForm);
var htmlBody = HtmlService.createHtmlOutput(response).getContent();
var body = 'Dear '+mName+',\n\n'+mMessage+'\nPlease acknowledge by submitting the form below.\nRegards,\nSchool Office';
GmailApp.sendEmail(eEmail,subject,body,{
noReply:true,
htmlBody: htmlBody
});
Is there anyway to embed the form in an email just like it does when you select 'include form in email' like the screenshot below?无论如何,当您选择“在电子邮件中包含表单”(如下面的屏幕截图)时,是否可以将表单嵌入到电子邮件中?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.