George wrote:
I have postfix with postfixadmin and everything stored in a mysql database.

How do I forward emails sent to a mail account to an external command?

Since you are using virtual aliases (postfixadmin w/mysql assumes so) you'll need to setup a pipe transport in master.cf and proper settings in /etc/postfix/transports. See the man pages of pipe and transport for more details than what you'll find in this email.

virtual alias:
foo...@exampe.com foo...@my_custom_transport.example.com

add to /etc/postfix/transports:
my_custom_transport.example.com         my_custom_transport:

add to /etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transports

add to /etc/postfix/master.cf:
my_custom_transport unix - n n - - pipe
  flags=flags_from_pipe_manual
  user=some_user:some_group
  argv=/path/to/my_custom_script vars_from_pipe_manual

This may be incomplete. It is a rough (very rough?) example of the configuration. I strongly recommend having a look at the pipe and transport manuals before attempting to implement any of this.

Reply via email to