Check out the sample code below to see just how easy it is to use the IMAP4
component of EasyMail .Net Edition. But don't let the ease of use fool
you; the IMAP4component is very powerful and packed with features.
The sample code on this page demonstrates the most basic features of the
IMAP4 component. Be sure to click on the "Other Samples" tab to find
more advanced samples.
| Sample Notes | | This sample uses the IMAP4 component to log into a mailbox and display the subject of each message. The subject is obtained from the IMAP envelope of the message, so no parsing is required to get this information. IMAP envelopes also contain other 'header' information such as the mesasge sender, recipients, date, etc... |
IMAP4 imap = new IMAP4(); imap.Connect("mail.yourdomain.com"); imap.Login("mailbox", "password"); imap.SelectMailbox("Inbox"); EnvelopeCollection imapEnvelopes; imapEnvelopes = imap.GetEnvelopes(); foreach (Envelope imapEnvelope in imapEnvelopes) { Console.WriteLine(imapEnvelope.Subject); } imap.Logout();
|