我編寫了一個程序C#
,它連接到POP Server
,並使用POP3
命令RETR
從服務器檢索原始電子郵件消息字符串。 由於程序檢索到的電子郵件爲純文本格式,所有標題和郵件正文相同,所以很難從原始字符串中提取每個標題和郵件正文。如何將原始電子郵件字符串解析到System.Net.Mail.MailMessage對象中?
有人可以告訴我一個解決方案,我可以解析整個原始文本到一個System.Net.Mail.MailMessage
對象?
下面是一個示例電子郵件原始字符串:
+OK 1281 octets
Return-Path: <[email protected]>
Delivered-To: samplenet-sample:[email protected]
X-Envelope-To: [email protected]
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"
<[email protected]>
To: [email protected]
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: <[email protected]>
TEST Body
.
感謝您的幫助。讓我看看它。 – Xmindz