我怎样才能得到一个特定人发送的电子邮件列表?
How can I get a list of emails sent from a particular person?
我正在使用 Google Gmail API 获取邮件列表。我想做的是获取特定用户发送的所有消息的列表。这是我目前所拥有的:
var oauth2Client = new OAuth2('', '', '');
oauth2Client.setCredentials(token);
var gmail = google.gmail('v1');
gmail.users.messages.list({
auth: oauth2Client,
userId: 'me'
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
cb(null, false);
} else {
cb(null, response);
}
});
我尝试设置 userId: 'person@email.com'
但出现以下错误:
The API returned an error: Error: Delegation denied for person@email.com
我错过了什么?提前感谢任何答案!
您应该使用 q
参数,其值如下:from:person@email.com
。它会按 from
header 过滤电子邮件。
那么您正在尝试使用 userId: 'person@email.com
Google API 认为您想要来自 person@email.com
收件箱的电子邮件列表(但您无权访问它)。
我正在使用 Google Gmail API 获取邮件列表。我想做的是获取特定用户发送的所有消息的列表。这是我目前所拥有的:
var oauth2Client = new OAuth2('', '', '');
oauth2Client.setCredentials(token);
var gmail = google.gmail('v1');
gmail.users.messages.list({
auth: oauth2Client,
userId: 'me'
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
cb(null, false);
} else {
cb(null, response);
}
});
我尝试设置 userId: 'person@email.com'
但出现以下错误:
The API returned an error: Error: Delegation denied for person@email.com
我错过了什么?提前感谢任何答案!
您应该使用 q
参数,其值如下:from:person@email.com
。它会按 from
header 过滤电子邮件。
那么您正在尝试使用 userId: 'person@email.com
Google API 认为您想要来自 person@email.com
收件箱的电子邮件列表(但您无权访问它)。