Retrieving and parsing emails from Pop3 server using C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am making a thin email client and want to get emails from a pop3
server...Is there any built in support in C# to get emails from a pop3 server
and parse the email to show up on the UI ?
 
No built-in support for a Pop3 client, no.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Hi Kevin,

Thanks for your response.

I have manged to write a client that retrieves the mails from the pop3
server using TcpClient and Pop3 APIs, but what I get is a raw email. Since
the email format I assume is standard could you suggest a way to parse it so
as to access the relevant data like subject, from, to and message body... Any
sort of classes available in C# for such parsing functionality... If no, what
would be the best way to go about it?

Alpana
 
Hi Alpana,

First, congratulations on writing a POP3 client. Good show. Now, I'm afraid
you'll have to write your own parser. The SMTP protocol defines the
structure of an email message as a text file. So, you'll have to write your
own parser for this. It is a bit more complicated, because an Internet
Message may be pure text or HTML, and may have attachments of various types
(MIME types), which will need to be decoded from the Base64 text format they
are stored in. An HTML email message may also have references and links to
external resources, such as images.

The good news is, if you can write your own POP3 client, I'm sure you can
handle writing an Internet Message parser as well. Here are a couple of
links to the standards references to help you get started:

http://www.faqs.org/rfcs/rfc2822.html
http://www.faqs.org/rfcs/rfc2045.html

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Back
Top