2013-01-11 26 views
0

我有幾個別名與我的Google Apps for Education帳戶相關聯。 Getaliases可以獲得所有這些,這很好,但是當我嘗試使用sendEmail發送電子郵件時,它似乎只能與第一個別名一起工作,這是我個人的一個。如果我使用除[0]以外的別名嘗試它,則不會發生任何反應,並且我不會收到錯誤。Google Apps腳本:使用帶有來自Getaliases的第二個別名的sendEmail()

任何幫助,將不勝感激。先謝謝你。

回答

0

這是getAliases()的示例。 WFM。

// Log the aliases for this Gmail account and send an email as the first one. 
var me = Session.getActiveUser().getEmail(); 
var aliases = GmailApp.getAliases(); 
Logger.log(aliases); 
if (aliases.length > 0) { 
    GmailApp.sendEmail(me, 'From an alias', 'A message from an alias!', {'from': aliases[0]}); 
} else { 
    GmailApp.sendEmail(me, 'No aliases found', 'You have no aliases.'); 
} 
0

我也有類似的問題,卻在絞盡腦汁我的大腦,只是我一直在使用MailApp而不是GmailApp實現。

這可能無法解決所有人的問題,但它只是添加到某人可能犯的錯誤清單中。

相關問題