Monitor Exchange Email Address and run scripts

Posted by WernerCD on Server Fault See other posts from Server Fault or by WernerCD
Published on 2011-06-21T14:15:38Z Indexed on 2011/06/21 16:24 UTC
Read the original article Hit count: 538

Filed under:
|
|
|

Okay... Not sure how "out there" this thought is...

Right now to send a pager message (aka text message), a user logs into our AS400... logs into the program... enters user name and message and hit's F10 to send.

With a little looking, it seems that you can run remote commands to the AS400 via FTP. So I'm working on building a script (batch or otherwise) that, given two parameters (user, message), will FTP into the AS400 and run a remote command:

c:\>ftp server
user: admin
password: *****
ftp> quote rcmd SNDPGRMSG TOPGR(JDOE) MSG('This is a Test')
ftp> quit

So... what I want to do is

setup an email account on our Exchange server
Monitor the account for incoming mail
upon receipt of incoming mail, parse it... say for example subject is defined as "Recipient" and email text is defined as "Pager message"
run a batch that uses the above mentioned TOPGR and MSG as parameters... via FTP to the AS400
mark email as "read"

The main thing I'm not sure about is monitoring an exchange account and running a script on incoming emails. I'm sure what I want to do is possible... but where would I start?

EDIT: Clarification

The main reasons for using this four part system are logging (messages sent via this are logged and reported by the AS400 program) and the existing scheduler for redirecting pages (For example, the weekly on-call person = TOPGR(oncall) gets updated by the AS400 program).

I'm also trying to remove duplicate work. If I can get this setup working, I can redirect pages from OTHER systems into this one. I then don't have to update 2, soon to be 3, systems with current phone numbers, carriers, on-call schedules, etc. System #2 and #3 can just "email" [email protected].

© Server Fault or respective owner

Related posts about ftp

Related posts about exchange-2010