【发布时间】:2014-11-06 08:46:21
【问题描述】:
我是 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限制或代码中的任何问题,请指导我
谢谢 拉梅什
【问题讨论】:
-
您能显示实际发送和接收的 IMAP 请求和响应吗?
-
您必须显示对 Folder.search() 的调用,如何构造 search() 的参数,以及理想情况下产生的 IMAP 命令。
-
@legoscia,@arnt 感谢您的回复,我已经更新了我的代码。请立即查看
标签: email outlook imap outlook.com