public class ReadEmailPop3 { public void GetEmailContent() { using (Pop3Client client = new Pop3Client()) { client.Connect("server", 110, false); //账号,密码,认证方式 client.Authenticate("你的账号", "密码", AuthenticationMethod.Auto); //登录认证 int count = client.GetMessageCount(); //获取邮箱总数 for (int i = 1; i <= count; i++) { GetEmailHeader(client.GetMessage(i)); client.DeleteMessage(i); //删除邮件 } //int size = client.GetMessageSize(1); //获取编号为1的邮件的大小 } } private void GetEmailHeader(OpenPop.Mime.Message msg) { //从msg中的Headers成员中获取信息 string Email = msg.Headers.From.Address; if (!string.IsNullOrEmpty(Email)) { DateTime SendDate = msg.Headers.DateSent.ToLocalTime(); string Subject = msg.Headers.Subject; //获取正文内容,其中包括 这些换行符 string Body = msg.FindFirstPlainTextVersion().GetBodyAsText(); //获取邮件html内容 OpenPop.Mime.MessagePart htmlMessage = msg.FindFirstHtmlVersion(); string htmlText = htmlMessage.GetBodyAsText(); } } }