I wrote a program in C# that connects to a POP Server and retrieves raw strings of email messages from a server using the POP3 RETR . Since the email message received by the program is in text format with all the headers and body of the message in the same, it is too difficult to extract each header and body of the message from the raw string.
Can someone tell me a solution with which I can parse all the raw text into a System.Net.Mail.MailMessage object?
The following is an example of a raw string:
+OK 1281 octets Return-Path: < sample@test.in > Delivered-To: samplenet-sample: in-sample2@test.in X-Envelope-To: sample2@test.in Received: (qmail 53856 invoked from network); 22 Sep 2012 06:11:46 -0000 Received: from mailwash18.pair.com (66.39.2.18) MIME-Version: 1.0 From: "Deepu" < sample@test.in > To: sample2@test.in Date: 22 Sep 2012 11:41:39 +0530 Subject: TEST Subject Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: < 20120922061146.2975C11554D@mailwash18.pair.com > TEST Body .
source share