Frank Garrett
Frank Garrett

Reputation: 11

How can I pipe to a php script in postfix?

How can I have all emails going to:

help[at]mydomain.com to go to /home/user/public_html/helpdesk.php

Do I set that up in /etc/postfix/virtual ?

If so what would the syntax be and is anything else needed?

Upvotes: 1

Views: 3027

Answers (1)

Kris
Kris

Reputation: 2128

Add the following to your main.cf:

virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps

Create /etc/postfix/virtual_alias_maps with the following content:

/help@mydomain\.com/ helpdesk-php

Add the following line to /etc/aliases:

helpdesk-php: "|/usr/bin/php /home/user/public_html/helpdesk.php"

Activate everything with something like the following (depending on your linux distro):

postmap /etc/postfix/virtual_alias_maps
newaliases
service postfix reload

Upvotes: 1

Related Questions