0

我是 IMAP 的新手。

我正在尝试从 Outlook.com 获取邮件,我已在我的电子邮件客户端中配置了 Outlook.com IMAP 设置。我能够连接并从 outlook.com 获取消息。

但是当我试图通过使用搜索词来获取消息时

我正在使用 Java 邮件包。

IMAPStore store = getStore(serverName, userName, password, port);
IMAPFolder inboxFolder = (IMAPFolder) store.getFolder("INBOX");

SearchTerm[] searchTerms = new SearchTerm[4];

Address address = new InternetAddress("search_email_address");
SearchTerm toTerm = new RecipientTerm(Message.RecipientType.TO, address);
SearchTerm ccTerm = new RecipientTerm(Message.RecipientType.CC, address);
SearchTerm bccTerm = new RecipientTerm(Message.RecipientType.BCC, address);
SearchTerm fromStringTerm = new FromStringTerm(searchEmail);

searchTerms[0] = toTerm;
searchTerms[1] = ccTerm;
searchTerms[2] = bccTerm;
searchTerms[3] = fromStringTerm;

OrTerm orTerms = new OrTerm(searchTerms);

inboxFolder.search(orTerms);

我正在尝试在 IMAP 文件夹中使用上述搜索词搜索邮件,但我收到的邮件为零。

此中的任何 API 限制或代码中的任何问题,请指导我

谢谢拉梅什

4

1 回答 1

0

看看“IMAP 搜索是否可以在 Outlook.com 上工作”这个问题,我可以说:是的。

我正在使用imapsync从 Outlook.com 同步到其他邮箱,它可以正常工作。在幕后 imapsync 使用 IMAP 搜索。

outlook.com 宣布的 IMAP 功能有:

IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION BACKENDAUTHENTICATE CHILDREN IDLE NAMESPACE LITERAL+ AUTH

也许这对某人有帮助。这也可以解释为什么某些搜索关键字可能会或可能不会起作用。

于 2020-10-27T12:07:08.530 回答