How to read emails on mail server ?

First of all there are multiple protocols to retreive mail:
POP3, IMAP, etc...
I suggest you start by familiarizing yourself with the various components that make up an e-mail system.
  • Mail Transfer Agent (Protocol: SMTP)
  • Mail Delivery Agent (Protocols: POP3, IMAP)
  • Mail User Agent (Outlook, Webmail, Thunderbird, your application)
Basically what you are trying to write is a Mail User Agent. A mail user agent has to "fetch" the mails from a Mail Delivery Agent using either POP or IMAP.
This means you will have to learn about these two protocols:
POP3 RFC: http://www.faqs.org/rfcs/rfc1939.html
IMAPv4 RFC: http://james.apache.org/server/rfclist/imap4/rfc2060.txt
Since e-mail communication happens using TCP/IP you will have to learn how to use the classes in the System.Net.Sockets namespace.
Also take a look at the TcpClient class.
Try to understand these concepts first and then I suggest you start out with POP3, this protocol is quite easy. If you have problems then with very specific TcpClient code please update your question or post a new question.
Hope this sets you on the right track.

P/S: I've complete my first program that read emails in Gmail & Download the attachments in selected emails (using VB.NET 2008).

Tools - Get file attachment from selected mail list in Gmail account

This tools is my School Project, it useful when you have to download all attachment from a lot of mail in Gmail account.

Tools describe:
 - Login gmail through port 993 with SSL - Using IMAP
 - Have Filter to filter Email with the Subject condition, there has 3 method to filter "Begin with, Contains and End with". To clear Filter, press "Clear Filter" button or leave the Filter text blank and press "Go Filter"
 - An Email has Attachments will have prefix "[A]" in the email list and before email Subject
 - Load 50 emails per page, have "Go to Page" button to move to others page, and the "Next Page" button to move to next page or "Previous Page" to move back to the previous page
 - Select 1 or more emails, and Download Attachment of those email to the folder that user selected.

P/S: Each first running time, the program will running slow because it have to examine the data. If you have any problem when using this, please contact me. Thanks for using program.

Download here (MediaFire link)
Author: UK Tran

Sponsors