[英]can we fetch email from inbox and sentbox in one call (gmail API PHP)
i'm using Gmail API to fetch messages. 我正在使用Gmail API提取邮件。 if i do like this
如果我喜欢这个
$labelIds = ['INBOX'];
$opt_params=[
'labelIds' => $labelIds,
];
$list = $gmail->users_messages->listUsersMessages('me',$opt_params);
it will work fine. 它将正常工作。 and return messages.
并返回消息。 but if i mention SENT label with INBOX then it return nothing.
但是,如果我用INBOX提到SENT标签,那么它什么也不会返回。 what am i doing wrong?
我究竟做错了什么?
$labelIds = ['INBOX', 'SENT'];
i want to fetch emails from both inbox and sentbox in one call. 我想在一个呼叫中同时从收件箱和发件箱中获取电子邮件。
Your code lists messages that has both the INBOX
and SENT
labels. 您的代码列出了同时具有
INBOX
和SENT
标签的邮件。 You can list messages that has either one with the OR
operator: 您可以使用
OR
运算符列出具有任一消息的消息:
$opt_params=[
'maxResults' => 50,
'q' => 'in:inbox OR in:sent',
];
$list = $gmail->users_messages->listUsersMessages('me', $opt_params);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.