Shane121
Shane121

Reputation: 443

Show amount of unread emails in C#

I want to show how many unread emails I have in my inbox (gmail) and show this number in a label.

e.g Inbox(3)

I've tried a load of sites but couldn't get anything.

I'm new to programming in general so any help would be great.

Upvotes: 3

Views: 1198

Answers (3)

Ants
Ants

Reputation: 2668

The simplest is to do a query to: http://mail.google.com/mail/feed/atom/unread/

You can read more about it here: http://googlesystem.blogspot.com/2008/03/feed-for-unread-gmail-messages.html

As pointed out by @TheVillageIdiot, there is a the code gallery at http://code.msdn.microsoft.com/CSharpGmail . Scroll down and read about GmailAtomFeed.

Upvotes: 3

TalentTuner
TalentTuner

Reputation: 17556

You need to do something like below.

1- Maintain a column (Say IsReaded) in the database table if you are using some database table to store your email.

1- When ever user clicks an email , you need to update the column in database table to 'Y'.

you can do this task asynchronously, using Ajax

2- Just use this Sql ' select count(1) from tblMessages where IsRead ='N''

3- than update the label with the count.

Upvotes: 1

TheVillageIdiot
TheVillageIdiot

Reputation: 40497

Hope this page on code gallery will help you.

Upvotes: 3

Related Questions