On Wed, Feb 27, 2013 at 03:42:36PM -0700, Joshua Hopkins wrote:
> I have the need to pipe commands for a few virtual domains.  I 
> understand that the /etc/aliases is usually used for this but the 
> problem I will be running into is needing more than one local user 
> with the same name.
> 
> Example requirement:
>      supp...@domain1.com
> 
>       support: "| /var/www/domain1/support/support.php"
> 
>      supp...@domain2.com
> 
>       support: "| /var/www/domain2/support/support.php"
> 
> If there was just 1 domain this would not be an issue.  Can
> piping commands be placed in the virtual domain config?

No.

> What would be the best way to make this happen?

I'd use virtual(5) aliases, perhaps in conjunction with a 
$recipient_delimiter, to alias each one to a system user.

main.cf :

mydestination = localhost, localhost.$mydomain[, ... ]
### I use "-" if planning to use delimited addresses in the real
### world, because a lot of stupid web forms reject "+" in email
### addresses
recipient_delimiter = +
virtual_alias_maps = hash:/etc/postfix/virtual
[ ... ]

/etc/postfix/virtual :

supp...@example.com     support+example.com@localhost
supp...@example.net     support+example.net@localhost
supp...@example.org     support+example.org@localhost
[ ... ]

Create a system user, "support", and use .forward files:

~support/.forward+example.com :
"| /var/www/bin/support/support.php example.com"

~support/.forward+example.net :
"| /var/www/bin/support/support.php example.net"

~support/.forward+example.org :
"| /var/www/bin/support/support.php example.org"

Refer to:

http://www.postfix.org/virtual.5.html
http://www.postfix.org/aliases.5.html
http://www.postfix.org/local.8.html
http://www.postfix.org/postconf.5.html#recipient_delimiter
http://www.postfix.org/postconf.5.html#virtual_alias_maps

Other choices include pipe(8) and transport(5) maps, but this seems 
simpler to me.
-- 
  http://rob0.nodns4.us/ -- system administration and consulting
  Offlist GMX mail is seen only if "/dev/rob0" is in the Subject:

Reply via email to