Alias pipe to program


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

issues: "|/usr/local/sbin/mailhandler"


I have the same question. it did not work in my case.


I got it to work by changing mydestination on but then no other emails were working.

I tried to have both and localhost on $mydestination but that made other emails useless.

don’t think virtual_mailbox_maps virtual_alias_maps can pipe into a program. any idea how can I achieve this?

now I’m thinking to have a separate email server just to pipe emails into a script (which is a stupid workaround).

UPDATE: apparently sieve has a plugin called extprogram that does what I need. but did not manage to get it to work


Has anyone had any luck with this

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



Did you ever end up figuring this out? Trying to do something similar.


This might help, never tested though: