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