我正在创建gmail附加组件。有什么办法可以打电话给时间 用户安装加载项时触发每个用户?
function getMail(){
var interval = 5;
var date = new Date();
var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
var threads = GmailApp.search('is:inbox after:' + timeFrom);
var emailAddress = Gmail.Users.getProfile("me").emailAddress;
for (var i = 0; i < threads.length; i++)
{
var data=Gmail.Users.Messages.get(emailAddress,threads[i].getId(),
{format: "RAW"}).raw;
var signature =Utilities.newBlob(data).getDataAsString();
Logger.log(signature);
}
}
function trigger(){
ScriptApp.newTrigger("getMail").timeBased().everyMinutes(1).create();
}
function onInstall(e){
trigger();
}