Postfix - Pipe Emails to a Script

Comments

Piping an email to a script is a rather handy feature. It’s popular with service desk software as well as notification systems. With Postfix, there are 2 ways to go about it - you can either set up filters or set up an ‘pipe alias’. I tend to prefer the latter as it’s quicker to set up, even though it’s not the ‘correct’ way :)

All you need to do is add a new line to /etc/aliases like so:

emailaddress: "|/path/to/script"

Don’t forget to run newaliases afterwards.

If you’re using a virtual domain setup, then edit your virtual aliases file and add a line to pipe it to the entry above:

[email protected] emailaddress

Once this is done, simply hash the virtual aliases file and off you go!

Next Post
PHP - Generate Random Strings

Previous Post
Setup Virtual Domains in Postfix (Without a Database)


comments powered by Disqus