我可以在Gmail中手动从辅助邮件帐户发送电子邮件,所以这很好用。再次明确一下:它不应该作为abc@gmail.com发送,而应该作为abc@domainname.com发送)
在G-Script中,我使用MailApp.sendEmail({ -在纪录片中,似乎只有设置发送者姓名和replyTo地址的选项。如果我这样做,abc@gmail.com仍然显示为发件人。有没有办法改变发送者本身?
纪录片:https://developers.google.com/apps-script/reference/mail/mail-app
发布于 2016-09-27 22:20:11
如果您的辅助电子邮件被设置为您的电子邮件帐户的别名,这是可能的。规范中提到:
from:发送电子邮件的地址,必须是getAliases()返回的值之一
在执行getAliases()时,您看到自己的别名了吗?
// 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.');
}https://developers.google.com/apps-script/reference/gmail/gmail-app#getAliases()
https://stackoverflow.com/questions/39722670
复制相似问题