HOW TO fetch unread emails from a mail server

I learnt today that fetching unread email messages is not natively supported by POP3.
The POP3 protocol does not provide the ability to ask the server which emails are "unread". Furthermore, a pure POP3 server does not even keep this information. Some servers, such as Exchange Server, expose both POP3 and IMAP interfaces. In these cases, information about read/unread status exists on the server, but it is only available via the IMAP protocol.

There is a code sample on getting the list of unread messages from an IMAP server using a commerical component Rebex Mail for .NET. Although I haven't tried, I guess this can be achieved using IMAP components like these -
IPWorks! IMAP Component from /n software
Rebex Mail for .NET
Chilkat IMAP .NET
EAGetMail IMAP4 Component
Lumisoft (free)
xemail-net (free)
InterIMAP (free)

So what's the difference between IMAP and POP? An answer from the Gmail FAQ -
Unlike POP, IMAP offers two-way communication between your web Gmail and your email client(s). This means when you log in to Gmail using a web browser, actions you perform on email clients and mobile devices (ex: putting mail in a 'work' folder) will instantly and automatically appear in Gmail (ex: it will already have a 'work' label on that email the next time you sign in).

IMAP also provides a better method to access your mail from multiple devices. If you check your email at work, on your mobile phone, and again at home, IMAP ensures that new mail is accessible from any device at any given time.

Finally, IMAP offers a more stable experience overall. Whereas POP is prone to losing messages or downloading the same messages multiple times, IMAP avoids this through two-way syncing capabilities between your mail clients and your web Gmail.

If you're trying to decide between using POP and using IMAP with Gmail, we recommend IMAP.

Also see:
HOW TO avoid Spam Filters while emailing programmatically
HOW TO view only the unread messages in your Gmail inbox
So, you want to be a Gmail ninja?

Comments

Popular posts from this blog

Maven Crash Course - Learn Power Query, Power Pivot & DAX in 15 Minutes

"Data Prep & Exploratory Data Analysis" course by Maven Analytics

Oracle Cloud Infrastructure 2024 Generative AI Professional Course & Certification Exam (1Z0-1127-24)