Is it possible to forward messages intended for a particular email to the standard input of a program. With postfix this would be handled through an alias that pipes into the program.
Something like this
add line into file: /etc/aliases
I am trying to pipe an email alias to a php file for some processing
I can get this done through /etc/aliases but cannot work out how to route an email from mailinabox to one of the local accounts so it can be automatically piped to my php script
It’s a bit more work than expected but I managed to get it working.
In addition to adding an alias in /etc/aliases the transport for the user also has to be set to local and the mailbox needs to exist.
Add a mail user as normal.
In /etc/postfix/main.cf find transport_maps. It probably doesn’t exist, so add it, for example transport_maps = hash:/etc/postfix/transport. /etc/postfix/transport probably doesn’t exist so create this file. The contents are the email user you just added followed by local:
If it’s not working try newaliases postmap /etc/postfix/transport
restart postfix service