Monitor exchange email account

I'm trying to write a program that will listen to an email inbox from an Exchange 2003 mail server, process the subject line of the mail and do something depending on that subject.

For example, I might send 'reply to me' and it will send me an email and so on.

I was thinking of doing this using the JavaMail API to connect to the mailbox (I think this is possible) and use the Timer class to poll the mailbox for new messages at a given interval (rather than use an infinite loop with Thread.sleep()). I've looked at the 'monitor' example in JavaMail but that only seems to be for IMAP and uses an infinite loop.

Can anyone let me know:

1. Is this even possible to an Exchange Server?

2. Is the Timer class the best solution or is there a better way?

3. Is there an implementation already that will save me some dev time?

Thanks in advance.

[896 byte] By [el_chupanegrea] at [2007-11-27 7:40:18]
# 1

1. Yup.

2. Either is fine... Timer sleeps.

3. Not that I've ever heard of.

And... such an app will only wash on an intranet... (Most) ISP's will detect the script activity (response to fast, and/or to regular) and disable your account on the grounds of "spammer like" activities.

corlettka at 2007-7-12 19:20:48 > top of Java-index,Java Essentials,Java Programming...
# 2
I haven't looked at the sources, but I'd expect that timer uses an infinite loop and Thread.sleep()...
CeciNEstPasUnProgrammeura at 2007-7-12 19:20:48 > top of Java-index,Java Essentials,Java Programming...
# 3
I looked, and it does Cec.
corlettka at 2007-7-12 19:20:48 > top of Java-index,Java Essentials,Java Programming...