5

I have been asked to setup an automated trigger on Unix upon receiving a certain kind of email from MS Exchange server.

The requirement is to trigger a shell script when any person from a fixed list of senders sends an email via MS Exchange server to a designated email account on unix.

For example:

Email from rob81@host1.com (Exchange Server) sends an email to unix@host2.com (Linux) with the subject: Unlock Account X

This ideally should trigger a shell script that will have code to unlock Account X.

Is there a way to configure this on Unix so that upon receiving an email as described above, I can trigger a shell script?

1
  • 4
    procmail might help you in this case
    – Rahul
    Aug 3, 2016 at 10:59

1 Answer 1

8

There are multiple solutions to this problem. As suggested by Rahul in the comments, I would use procmail and edit .procmailrc to something like this:

:0
* ^From.*someone.i.dont.like@somewhere.org
* !^FROM_DAEMON
* !^FROM_MAILER
* ^Subject:.*Unlock
| /path/to/your/script
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.