ImapExamineFolder Method |
Namespace: MailBee.ImapMail
Exception | Condition |
---|---|
MailBeeException | An error occurred and ThrowExceptions is true. |
When the folder is selected for read-only access, the selected folder is identified as read-only. No changes to the permanent state of the folder, including per-user state, are permitted; in particular, when messages are downloaded, they won't lose the \Recent flag.
To select the folder for read-write access, the developer should use SelectFolder(String) method.
The developer should specify the full name of the folder (including all parent folders' names if the folder is subfolder of another existing folder). See CreateFolder(String) topic for details regarding folder names.
using System; using MailBee; using MailBee.ImapMail; using MailBee.Mime; class Sample { static void Main(string[] args) { Imap imp = new Imap(); // Connect to the server and log in the account. imp.Connect("mail.domain.com"); imp.Login("jdoe", "secret"); // Select the folder in read-only mode. imp.ExamineFolder("Inbox"); if (imp.MessageCount > 0) { // Download and save last message into a file. // If the message is recent, it won't loose \Recent flag. MailMessage msg = imp.DownloadEntireMessage(imp.MessageCount, false); msg.SaveMessage(@"C:\Temp\msg.eml"); } imp.Disconnect(); } }