views:

135

answers:

3

I want to notify users when he receives a certain Email with a specific sound. So I need to detect the title of Email.

I can use MailMessage in framework 2.0, but this class is not supported in compact framework on Windows Mobile. Any suggestion about which class can I use? Or is it impossible?

A: 

There is Microsoft.WindowsMobile.PocketOutlook namespace, but I believe that it doesn't allow you to read mail messages. Probably you would need to use MAPI. See this blog for getting started. A lot of unmanaged code is involved.

kgiannakakis
Looks like PR_SUBJECT in Message Envelope Properties is what I'm searching for. Any guide on how to use that property?
iPhoney
+1  A: 

Another option is to use POP3.

Use an ordinary socket-connection and connect to your user's mail-account (normally port 110). You can then execute some POP3-commands such as TOP which retrieves a part of the message. For instance:

Example 1 - Return headers only:

TOP 1 0
+OK Top of message follows
--- all message headers ---

Example 2 - Return headers and first 10 lines of body:

TOP 1 10
+OK Top of message follows
--- all message headers ---

--- first 10 lines of body ---

When you receive the same, you can parse the text for the word: "Subject:" which is part of the headers.

Here is a web-page covering some basic POP3-commands. In any case, by using Google you can find a lot of useful information about POP3.

Good luck

moster67
Thanks, it works. It is much easier than the MAPI way.
iPhoney
+1  A: 

You can intercept e-mails with IMapiAdviseSink

http://blogs.msdn.com/hegenderfer/archive/2009/04/28/intercepting-mail-using-imapiadvisesink.aspx

Joel