5

This question already has an answer here:

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?

marked as duplicate by Anthon, Rahul, Kusalananda, Networker, Stephen Kitt Aug 3 '16 at 15:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    procmail might help you in this case – Rahul Aug 3 '16 at 10:59
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

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