GmailApp.getAliases()返回一个空白列表 [英] GmailApp.getAliases() returns a blank list

查看:75
本文介绍了GmailApp.getAliases()返回一个空白列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用别名的用户.在admin.google.com中,我可以查看所有别名,但是当与该用户一起时,我仅使用以下代码创建Google Apps脚本:

I have a user with aliases. In admin.google.com I can view all the aliases, but when with that user, I create a Google Apps Script with only this code:

var aliases = GmailApp.getAliases();
Logger.log(aliases);

日志为空:"[]".

我也尝试在启用了超级管理员用户和管理员目录API的情况下创建脚本,但结果是相同的.我需要这种方法来发送电子邮件,如下所示:

I try to create the script also with an Super Admin User and Admin Directory API enabled but the result is the same. I need this method to send email like this:

GmailApp.sendEmail(email , "Subj.. ", "body....", {from: aliases[0]}); 

为什么这行不通?

推荐答案

Google Apps域(例如,商业,教育)有帐户别名,用于在登录Google Apps时进行身份验证.

There are account aliases for a Google Apps domain (e.g. Business, Education), which are for authentication during login to Google Apps.

还有GMail的帐户别名,与Google Apps帐户别名分开.这些是您调用 GmailApp.getAliases()时显示的别名.

There are also account aliases for GMail, which are separate from the Google Apps account aliases. These are the aliases that would show up when you call GmailApp.getAliases().

这篇关于GmailApp.getAliases()返回一个空白列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆