Where is the IMAP support in the .NET Framework?

A year ago, Mitchell Sellers had a related question ...

I would like to access Google IMAP to send and receive emails in my custom application.

The point is, I would not like to use third party controls.

Do newer versions of the .Net Framework support IMAP? What options do I have?

+2


source to share


3 answers


There used to be Indy components for Borland Delphi that were ported to C # and .NET.



There is no built-in support for this. As I know.

+1


source


.NET framework is not supported for IMAP. You will need to use a third party component.

Try the Mail.dll email component , it's very affordable and easy to use:



using(Imap imap = new Imap())
{
    imap.Connect("imapServer");
    imap.Login("user", "password");

    imap.SelectInbox();
    List<long> uids = imap.SearchFlag(Flag.Unseen);
    foreach (long uid in uids)
    {
        string eml = imap.GetMessageByUID(uid);
        IMail message = new MailBuilder()
            .CreateFromEml(eml);

        Console.WriteLine(message.Subject);
        Console.WriteLine(message.TextDataString);
    }
    imap.Close(true);
}

      

You can download it here: http://www.lesnikowski.com/mail/ .

0


source


There is no IMAP support in current versions of .NET, and I haven't heard of any plans to add such support to the framework. You should try one of the third party components.

You can check Rebex Secure Mail .

The following code shows how to download messages from a folder Inbox

:

// create client, connect and log in 
Imap client = new Imap();
client.Connect("imap.example.org");
client.Login("username", "password");

// select folder 
client.SelectFolder("Inbox");

// get message list 
ImapMessageCollection list = client.GetMessageList(ImapListFields.Fast);

if (list.Count == 0)
{
    Console.WriteLine("There are no messages in the mailbox.");
}
else 
{
    // download the first message 
    MailMessage message = client.GetMailMessage(list[0].SequenceNumber);
    ...
}

      

Trial can be downloaded from www.rebex.net/secure-mail.net/

You can also enjoy Rebex Q & Forum , which runs on a similar engine as this site.

-2


source







All Articles