Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identifying the Inbox folder through IMAP

Tags:

java

imap

I have connected to an email Store via IMAP (outlook.office365.com). I can work out which folders to use for deleted, spam, outbox and so on, using the LIST command which passes back flags that I can use.

The question is, "how do I know what to use for the InBox". I could just hard-code the name, but that seems likely to fail rapidly. I am sure I am missing something, because if the other folders are tagged, then "inbox" would be a strange omission.

Looking forward to your help. Thanks.

PS - I am doing this with the Java Mail API if that makes a difference to the response.

like image 628
7UpMan Avatar asked Feb 21 '26 02:02

7UpMan


1 Answers

By protocol specification, the main folder is a special folder always named INBOX.

See IMAP RFC 3501 §5.1:

The case-insensitive mailbox name INBOX is a special name reserved to mean "the primary mailbox for this user on this server". The interpretation of all other names is implementation-dependent.

like image 160
Max Avatar answered Feb 22 '26 14:02

Max



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!