Java – Gmail also extracts messages from sent messages

I have the following code to connect to the inbox of the mail server:

Store popStore = popSession.getStore("pop3");
popStore.connect(address,userName,password);
Folder  in@R_246_2419@Folder = popStore.getFolder("In@R_246_2419@");

Post this and I'll check the new email Now, when I connect to Gmail, I also receive messages from sent messages, which should only come from my Inbox folder Yahoo! This is working properly

Any idea can cause this problem in Gmail?

Editor: I tried too IN@R_246_2419 @, the result is the same

Solution

Interesting question I did some research and found this post. Google said:

To create a filter by sender:

String filter = "Not([SenderEmailAddress] = 'XXXXX@gmail.com')";
Items in@R_246_2419@Items = in@R_246_2419@Folder.Items.Restrict(filter);

among XXXXX@gmail.com Here is your email address This filter only provides you with items sent by people other than you In addition, the restrict method can be replaced by find, but for larger data sets, restrict will be faster

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>