Cudus
Cudus

Reputation: 37

How to retrieve the number of E-mail messages from mail server using VB.net and IMAP?

I managed to get a successful reply from the mail server (Gmail.com) using IMAP and vb.net with this code in this post

Now, I want to retrieve the number of E-mail messages from Inbox folder, how to do it?!

Upvotes: 1

Views: 500

Answers (1)

Max
Max

Reputation: 10985

After you connect to the server, you'll issue a set of commands like this:

A001 LOGIN <username> <password>
A002 SELECT INBOX

In response to the SELECT INBOX, the server will respond with a bunch of responses:

* OK [UIDVALIDITY 38]
* 13 EXISTS
* 0 RECENT
A002 OK Inbox selected.
...

The EXISTS response is the number of messages in the INBOX.

Upvotes: 1

Related Questions