IMAP邮件:AE.NET.Mail身体的电子邮件是空的 [英] Imap Mail : AE.NET.Mail Body Of Emails Are Empty
本文介绍了IMAP邮件:AE.NET.Mail身体的电子邮件是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用AE.NET.Mail阅读我的电子邮件的身体。
但所有这些机构都是空的!
我的codeS是象下面这样:
I use AE.NET.Mail to read my emails body.
but all those bodies are empty!
my codes are like below :
// Connect to the IMAP server. The 'true' parameter specifies to use SSL
// which is important (for Gmail at least)
ImapClient ic = new ImapClient("imap.soscharge.com", "main@domain.tk", "123",
ImapClient.AuthMethods.Login, 143, false);
// Select a mailbox. Case-insensitive
ic.SelectMailbox("INBOX");
Console.WriteLine(ic.GetMessageCount());
// Get the first *11* messages. 0 is the first message;
// and it also includes the 10th message, which is really the eleventh ;)
// MailMessage represents, well, a message in your mailbox
MailMessage[] mm = ic.GetMessages(0, 10);
foreach (MailMessage m in mm)
{
Response.Write(m.Sender + "<br /><br />");
}
foreach (MailMessage m in mm)
{
Response.Write(m.Sender + "<br /><br />");
}
// Probably wiser to use a using statement
ic.Dispose();
我的电子邮件是UTF-8 EN codeD。
这是什么问题?如何抓住这些机构?
my emails are utf-8 encoded.
what is the problem and how can i grab those bodies?
在此先感谢
推荐答案
没有为headersonly在默认情况下是真实的,在被指定为假消息的正文下载到的getMessages默认参数()方法:
There is a default argument in the GetMessages() method for "headersonly" which by default is true, when specified as false the body of the message is downloaded:
using (ImapClient ic = new ImapClient("imap.gmail.com",
"anemail@example.org",
"PasswordGoesHere!",
ImapClient.AuthMethods.Login,
993, true))
{
ic.SelectMailbox("INBOX");
Console.WriteLine(ic.ListMailboxes("",""));
// Note that you must specify that headersonly = false
// when using GetMesssages().
MailMessage[] mm = ic.GetMessages(0, 10, false);
foreach (MailMessage m in mm)
{
Console.WriteLine(m.From);
Console.WriteLine(m.Body);
Console.WriteLine();
}
}
Console.ReadKey();
这篇关于IMAP邮件:AE.NET.Mail身体的电子邮件是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文