Hello World example?

Jul 3, 2011 at 10:39 PM

I've downloaded the source and am trying to figure out the InterIMAPConsoleTest app, with little success. Could someone give me a little hello world bit of code that will demonstrate how to connect and read an email that contains an attachment? I am getting the message, but the AttachmentsAvailable property is false and the Attachments collection has a length of zero, not to mention there seems to be no html data in the message. Clearly I'm missing something obvious, I'd appreciate any help, thanks!

Jul 4, 2011 at 6:02 PM

Ok, I've switched over to the Async test app, and have had some success getting it to work and can see how to get attachments and html text. A couple more questions:

I see how to set a message as "read" via the MailboxManager.MarkMessageAsRead() method, but I don't see something similar for deleting a message. I'm not sure what MailboxManager.RemoveMessage() does; it didn't delete the message for me, and I could not understand what the code was doing. I ended up using MailboxManager.SetMessageFlag( _msg, InterIMAP.Common.MessageFlag.Deleted, true, false ), and this seemed to do the trick, but I'm wondering if this is the "right" way to do the job.

Next, I need to get notification when a new message arrives in the inbox. Unclear how to do this. I see the NewMessagesRequest class, but this looks like I need to use this in my own polling loop. I was thinking there might be an event that I could hook and be notified when a new message arrives instead of having to poll myself. If this exists, I can't find it. I could really use a little push in the right direction on how to monitor for new messages. Thanks!