2

I want to fetch all the mails (both read and unread) from my gmail account. What should be the best approach for this since I have 2GB of mails in by account.

M.S.
  • 4,283
  • 1
  • 19
  • 42

2 Answers2

0

OpenPop.NET is an open source implementation of a POP3 client.It allows easy access to email on a POP3 server in a matter of minutes.You can use this dll to get all the mails.

Here is the link to http://sourceforge.net/projects/hpop/ to download dll and you will get some examples here http://hpop.sourceforge.net/examples.php

Edit: To get all the messages

int messageCount = client.GetMessageCount();//client is POP3Client instance

List<Message> _allMessages = new List<Message>(messageCount);

for (int i = messageCount; i > 0; i--)    
     _allMessages .Add(client.GetMessage(i));
  • Thanks for answer but I've already tried this. I'm getting only unread mails not the read ones. – M.S. Mar 14 '14 at 10:36
  • I've used the same code but only unread mails are recieved :( – M.S. Mar 14 '14 at 10:47
  • The above code is used to get all the mails(read and unread). If you want to get only unread mails then you have to store seen UID's(read mails) but that is not your requirement.Check once – NullReferenceException Mar 14 '14 at 13:55
0

Actually it is the email server which control what emails you can download. Just like gmail give following options for pop - POP is enabled for all mail that has arrived since 5:36 pm - Enable POP for all mail (even mail that's already been downloaded) - Enable POP for mail that arrives from now on

Muhammad Amir
  • 131
  • 1
  • 5