在 Google 表单中自定义邀请电子邮件
Customize invitation email in Google Forms
我想在共享 google 表单时自定义邀请电子邮件。我在 Google 脚本文档中查找,但没有找到一些方法或 class 有用。如何自定义此邀请邮件?
通常这封电子邮件看起来像:
我想在页脚中添加公司图片,也许还可以添加一些文字。
没有创建您自己的自定义消息的方法。下面我将提出一个替代方案。
您可以创建一个发送自定义邮件的函数。只需使用您自定义的 HTML 内容创建一个 HTML 文件。
// i called this share.html in the apps script project
<h1>This is a header 1</h1>
<p>This is a paragraph</p>
<img src="<<SOME IMAGE SRC HERE>>" />
然后回到您的 code.gs 文件中,创建如下函数:
function shareForm() {
var html = HtmlService.createHtmlOutputFromFile('share').getContent();
var recipient = '<<EMAIL ADDRESS>>';
var subject = 'this is the subject';
var body = 'this will get overridden by the HTML service';
var options = {
htmlBody: html
};
MailApp.sendEmail(recipient, subject, body, options)
}
您可以 运行 从脚本编辑器中使用此功能,或者您可以构建一个按钮以添加到加载项下拉选项中。
我想在共享 google 表单时自定义邀请电子邮件。我在 Google 脚本文档中查找,但没有找到一些方法或 class 有用。如何自定义此邀请邮件?
通常这封电子邮件看起来像:
我想在页脚中添加公司图片,也许还可以添加一些文字。
没有创建您自己的自定义消息的方法。下面我将提出一个替代方案。
您可以创建一个发送自定义邮件的函数。只需使用您自定义的 HTML 内容创建一个 HTML 文件。
// i called this share.html in the apps script project
<h1>This is a header 1</h1>
<p>This is a paragraph</p>
<img src="<<SOME IMAGE SRC HERE>>" />
然后回到您的 code.gs 文件中,创建如下函数:
function shareForm() {
var html = HtmlService.createHtmlOutputFromFile('share').getContent();
var recipient = '<<EMAIL ADDRESS>>';
var subject = 'this is the subject';
var body = 'this will get overridden by the HTML service';
var options = {
htmlBody: html
};
MailApp.sendEmail(recipient, subject, body, options)
}
您可以 运行 从脚本编辑器中使用此功能,或者您可以构建一个按钮以添加到加载项下拉选项中。