Connects to an IMAP4 server on the standard IMAP4 port (143).
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, selects "Inbox" folder, downloads the last message entirely, and displays its body text. If the message is HTML formatted, plain-text version is displayed.
[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"); imp.Login("jdoe", "secret"); imp.SelectFolder("Inbox"); MailMessage msg = imp.DownloadEntireMessage(imp.MessageCount, false); msg.Parser.HtmlToPlainMode = HtmlToPlainAutoConvert.IfNoPlain; Console.WriteLine(msg.BodyPlainText); 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") imp.Login("jdoe", "secret") imp.SelectFolder("Inbox") Dim msg As MailMessage = imp.DownloadEntireMessage(imp.MessageCount, False) msg.Parser.HtmlToPlainMode = HtmlToPlainAutoConvert.IfNoPlain Console.WriteLine(msg.BodyPlainText) imp.Disconnect()
Imap Class | MailBee.ImapMail Namespace | Imap.Connect Overload List