-1

I have several aliases associated with my Google Apps for Education account at work. getAliases gets them all, which is nice, but when I try to send an email from them using sendEmail, it only seems to work with the first alias, which is my personal one. If I try it using any alias other than [0], nothing happens, and I don't get an error.

4

2 回答 2

1

我遇到了类似的问题并且绞尽脑汁,才意识到我一直在使用 MailApp 而不是 GmailApp。

这可能无法解决每个人的问题,但这只是添加到某人可能犯的可能错误的清单中。

于 2017-11-20T10:11:03.957 回答
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.');
}
于 2014-01-10T03:32:41.197 回答