ImapConnect Method (String) |
Namespace: MailBee.ImapMail
Exception | Condition |
---|---|
MailBeeException | An error occurred and ThrowExceptions is true. |
By default, MailBee can autodetect if the mail server you're connecting to requires SSL connection (this works for well-known mail services like gmail.com or live.com). Thus, this method can actually connect to the mail server on port 993 if you specified "imap.gmail.com" as serverName. To disable SSL mode and port autodetection, set AutodetectPortAndSslMode to false.
// 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();