Processing incoming emails with Python
Create a pipe alias in the aliases
file (e.g. /etc/aliases
).
[email protected] |/path/to/somescript.py
And then use the normal Python stdlib modules to tear the message apart.
If you need multiple addresses to point to it then have them all aliased to the newly-created alias.