谷歌应用程序脚本-自动电子邮件与png从html
Google Apps Script - automatic email with png from html
我创建了一个电子表格谷歌来收集电子邮件,并创建了一份脚本来自动发送带有文本+png图片的电子邮件。我没有成功。
你能帮我在自动电子邮件中添加附件吗?
文件名:White Diethtml:http://www.puresmile.com.au/wp-content/uploads/2015/10/Pure-Smile-White-Diet.png
这是我简单的(那个作品)脚本,但没有附上电子邮件中的图片。
function onFormSubmit(e) {
var timestamp = e.values[0];
var Firstname = e.values[1];
var Lastname = e.values[2];
var email = e.values[3];
var subject = "Puresmile White Diet - recommendations 24 hours";
var body = "Dear customer,'n'n Thank you for visiting Puresmile today.'n Please find the Puresmile White Diet attached. These after care recommendations will explain what to avoid and what's good for your white smile.'n'n To maintain your results for longer please:'n'n * avoid food or beverage (except water) for the next 2 hours after your treatment'n * follow the Puresmile White Diet for 24 hours after the treatment'n'n We hope you enjoyed your experience at our studio today!'n'n Best regards,'n Team Puresmile";
MailApp.sendEmail(email, subject, body)
}
MailApp
文档注意到如何包含附件,但在如何附加图像方面有点模糊。
我建议使用参数.sendEmail(email, subject, body, {attachments: [BlobSource]})
例如:
// Set URL of image
var url = "http://www.puresmile.com.au/wp-content/uploads/2015/10/Pure-Smile-White-Diet.png";
// UrlFetchApp is the class to retrieve hosted content
// .fetch() retrieves the file
// .getBlob returns a "blob" object of the data
// .getAs("image/png") returns a usable PNG image
var image = UrlFetchApp.fetch(url).getBlob().getAs("image/png");
// Add the "options" to the sendEmail method,
// where attachments is an array of Blobs
MailApp.sendEmail(email, subject, body, {
attachments: [image]
});
相关文章:
- 可以't让我的if语句处理js中的html表单输入
- 如何设置html元素填充的动画
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 如何将HTML id分配给元素,以及如何将JavaScript应用于元素
- 如何编写HTML输入的JS内联
- Dojo不解析自定义小部件的模板html中的小部件声明性
- 使用javascript将动态表从一个html页面打印到另一个html页
- 我如何将多个 svg 隐藏到一个 png 中,因为它们在 html 上
- 使用TableExport.js将HTML表格导出为PDF、WORD、PNG
- 您如何制作典型格式的照片,例如PNG,JPG等,用于像素级样式和脚本的HTML画布元素
- 如何仅使用Web技术(例如HTML,CSS和Javascript)重新创建图像,例如.png或.jpg
- Html代码到Png图像
- 如何将HTML转换为HTML5画布并下载为PNG文件
- 谷歌应用程序脚本-自动电子邮件与png从html
- 是自动创建为PNG文件的HTML Canvas标记的内容
- 将画布保存为png,在html/javascript Air应用程序中没有提示
- 从html的一部分创建png
- Html检索所有图像(jpg, png),而不提及图像的名称
- 图片png颜色css或html或javascript
- 如何将所有 HTML(包括 SVG 和底层 CSS/JS)转换为 PNG 或图像浏览器端