我正在尝试发送带有多个选项的Google电子表格的电子邮件:
如果我键入第一个附件,然后在代码中键入htlmbody,如下所示,该电子邮件以正确的车身内容和结构输出,但是两个附件不会出现
MailApp.sendEmail(recipient, subject,{attachments:[blob,blob1]} ,{htmlBody:html});
,如果我首先键入HTMLBODY,然后在代码中的附件键入,如下所示,该电子邮件与正文" [对象对象)一起传出,但是两个附件都存在!
MailApp.sendEmail(recipient, subject ,{htmlBody:html},{attachments:[blob,blob1]});
我在做什么错?为什么我不能同时使用两者?在这种情况下,我需要添加" CC"选项?
我已经只尝试了一个附件,结果是相同的!
https://developers.google.com/apps-script/reference/gmail/gmail/gmail/gmail-app#sendemail(字符串,字符串,字符串,字符串,object)
>GmailApp.sendEmail(recipient, subject , 'body if no html', {
htmlBody:html, attachments: [blob,blob1]
});
如果您知道他们有html,则可以用空字符串替换无HTML身体文本,但是占位符和空字符串必须在那里。
GmailApp.sendEmail(recipient, subject , '', {
htmlBody:html, attachments: [blob,blob1]
});