gpt4 book ai didi

java - Gmail 也从已发送邮件中获取邮件

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:55:51 34 4
gpt4 key购买 nike

我有以下代码连接到邮件服务器的收件箱:

Store popStore = popSession.getStore("pop3");
popStore.connect(address, userName, password);
Folder inboxFolder = popStore.getFolder("Inbox");

发布这个我检查新邮件。现在,当我连接到 Gmail 时,我也从已发送邮件中收到邮件,而实际上它应该只来自收件箱文件夹。雅虎这工作正常。

知道是什么导致了 Gmail 中的这个问题吗?

编辑:我也试过收件箱,结果是一样的

最佳答案

有趣的问题。我做了一些研究,发现 this post谷歌在其中说:

When you enable POP, all messages are downloaded to your client, except for Spam, Trash, and Chats. If you don't want messages that you send from the web interface downloaded to your mail client's inbox, we suggest creating a filter within your client.

要按发件人创建过滤器,您可以这样做:

String filter = "Not([SenderEmailAddress] = 'XXXXX@gmail.com')";
Items inboxItems = inboxFolder.Items.Restrict(filter);

XXXXX@gmail.com 是您的电子邮件地址。此过滤器将仅向您提供由您以外的其他人发送的项目。此外,Restrict 方法可以替换为 Find,但对于较大的数据集,Restrict 会快得多。

关于java - Gmail 也从已发送邮件中获取邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17651195/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com