MailRepository rep = new MailRepository("imap.mail.yahoo.com", 993, true, @"xxxxx@yahoo.com", "*******");
foreach (Message email in rep.GetUnreadMails("Inbox"))
{
//Console.WriteLine(string.Format("<p>{0}: {1}</p><p>{2}</p>", email.From, email.Subject, email.BodyHtml.Text));
Console.WriteLine(email.From);
Console.WriteLine(email.Subject);
Console.WriteLine(email.BodyHtml.Text);
if (email.Attachments.Count > 0)
{
foreach (MimePart attachment in email.Attachments)
{
Console.WriteLine(string.Format("<p>Attachment: {0} {1}</p>", attachment.ContentName, attachment.ContentType.MimeType));
}
}
}
以上是我的代码,用于读取邮件内容。当我尝试使用 gmail 端口时,它工作正常,但在使用 yahoo 或其他的时候。它不允许我阅读邮件抛出异常。有没有其他来源。请指导我