Connects to an IMAP4 server.
true if a connection attempt succeeded; otherwise, false.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample connects to the IMAP4 server, logs in the account and selects "Inbox" folder, then downloads the last message entirely, and displays filenames of all attachments.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.ImapMail; using MailBee.Mime; // The actual code (put it into a method of your class). Imap imp = new Imap(); imp.Connect("mail.domain.com", 143); imp.Login("jdoe", "secret"); imp.SelectFolder("Inbox"); MailMessage msg = imp.DownloadEntireMessage(imp.MessageCount, false); foreach (Attachment attach in msg.Attachments) { Console.WriteLine(attach.Filename); } imp.Disconnect();
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.ImapMail Imports MailBee.Mime ' The actual code (put it into a method of your class). Dim imp As New Imap imp.Connect("mail.domain.com", 143) imp.Login("jdoe", "secret") imp.SelectFolder("Inbox") Dim msg As MailMessage = imp.DownloadEntireMessage(imp.MessageCount, False) For Each attach As Attachment In msg.Attachments Console.WriteLine(attach.Filename) Next imp.Disconnect()
Imap Class | MailBee.ImapMail Namespace | Imap.Connect Overload List