2015-11-07 72 views
1

我的文档附件(anexo.doc) 使用谷歌Google Apps脚本发送电子邮件与我需要发送2附着在相同的电子邮件(anexo.doc和anexo2.doc)sendmail的谷歌Apps脚本安装多个文件

我如何做到这一点? 我的实际代码是:

file = DriveApp.getFilesByName('anexo.doc'); 

    if (file.hasNext()) { 
     MailApp.sendEmail(tomail, subject, msg, { 
     attachments: [file.next().getAs('application/msword')], 
    name: 'Automatic Emailer Script' 
     } 
    )} 

回答

2

这是行吗?

file = DriveApp.getFilesByName('anexo.doc'); 
file2 = DriveApp.getFilesByName('anexo2.doc'); 

if (file.hasNext() && file2.hasNext()) { 
    MailApp.sendEmail(tomail, subject, msg, { 
    attachments: [ 
     file.next().getAs('application/msword'), 
     file2.next().getAs('application/msword')], 
    name: 'Automatic Emailer Script' 
    } 
)} 
+0

是的,它的工作,谢谢 – Adriano