Send Form with MailApp after fetching html. Embed Google Form into email. Generated email contains only text

不羁的心 提交于 2019-12-21 17:25:06

问题


I want to embed a Google form in an email and send it with MailApp. I'm attempting to use code found at: 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,
  });
...

The logs show all the html for the form.

However, when I run the code, the email just looks like text, with the links at bottom. When I "show original" in the email, though, all that html for the form seems to be there, like in the log...

Would greatly appreciate any help.

What generated form looks like, want this to be embedded in email:

What they are getting instead:

来源:https://stackoverflow.com/questions/39882766/send-form-with-mailapp-after-fetching-html-embed-google-form-into-email-genera

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!