C# Imap邮件:AE.NET.Mail邮件正文为空

C# Imap邮件:AE.NET.Mail邮件正文为空,c#,email,.net-4.0,C#,Email,.net 4.0,我使用AE.NET.Mail阅读我的电子邮件。 但是那些尸体都是空的! 我的代码如下: // 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",

我使用AE.NET.Mail阅读我的电子邮件。 但是那些尸体都是空的! 我的代码如下:

    // 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编码的。 问题是什么?我怎样才能抓住那些尸体


提前感谢

仅headersonly的GetMessages方法中有一个默认参数,默认情况下为true,当指定为false时,将下载邮件正文:

        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();

headersonly的GetMessages方法中有一个默认参数,默认情况下为true,当指定为false时,将下载消息体:

        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();

谢谢你的回答,我有一些正方形代表一些物体。如何修复?需要看一个示例,但听起来可能是字符集问题。@JamesWarne从草稿中读取消息时,它以System.OutOfMemoryException的形式引发异常Folder@khushbu我相信这应该是一个单独的问题。谢谢你的回答,我有一些正方形代表一些物体。如何修复?需要看一个示例,但听起来可能是字符集问题。@JamesWarne从草稿中读取消息时,它以System.OutOfMemoryException的形式引发异常Folder@khushbu我认为这应该是一个单独的问题。