On a Ubuntu server, what's the easiest way to run a script (e.g. Python) when an email is received?

Email filters would be good, but not necessary.


2 Answers 2


Via procmail. (note this doc starts by suggesting using the .forward mechanism to invoke procmail from the MDA - its a lot simpler to use procmail AS the MDA)


If you're already running Sendmail you can add an alias to "|/bin/whatever/you/want/to/run".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .