从邮件服务器下载电子邮件并使用C#获取正确的邮件正文

时间:2017-09-27 10:29:47

标签: c# mime pop3

POP3 objPOP3 = new POP3(server.ToString(),Email.ToString(),password.ToString());
objPOP3.Connect();
if (objPOP3.IsAPOPSupported)
{
    objPOP3.SecureLogin();
}
else
{
   objPOP3.Login();
}

objPOP3.QueryServer();
int count = 0;
for (int index = LastDownloadIndex + 1; index <= objPOP3.TotalMailCount; index++)
{
        try
        {
            count = count + 1;
            string filename, name;
            EmailMessage objEmail = objPOP3.GetMessage(index, false);
            DateTime msgtime1 = Convert.ToDateTime(objEmail.Date);
            string msgsubject = objEmail.Subject.ToString();
            string msgbody = objEmail.Body.ToString().Replace("'", "");

我正在使用此编码从邮件服务器下载邮件,但那时候发送电子邮件内容就像这样

This is a multi-part message in MIME format.

--__=_AltPart_342684501_457771220
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Resume For Managing Director Resume For Managing Director Resume For Mana= ging Director Resume For Managing Director
--__=_AltPart_342684501_457771220
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Resume For Managing Director  Resume For Managing Director  Resum= e For Managing Director Resume For Managing Director
--__=_AltPart_342684501_457771220--

0 个答案:

没有答案