Saturday, June 13, 2015

How to Run a script when a mail arrives in mail server?



Looks like someone else has already answered this but thought I'd put down a specific answer for you.
I would use procmail and use a recipe in your .procmailrc similar to this:

#turn this off when you're finished testing :)
VERBOSE=on
LOGFILE=/home/user/procmail.log

:0 c #the c means continue on after this recipe is parsed
| /path/to/your/script
 
You'll also need a default recipe at the bottom to direct the mail into your maildir.

No comments:

Post a Comment