2015-11-07 46 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