[CentOS] /etc/aliases file wildcard

Wed Oct 28 12:53:20 UTC 2009
lhecking at users.sourceforge.net <lhecking at users.sourceforge.net>

Jerry Geis writes:
> I have been trying to find out if the /etc/aliases file
> can accept wildcards in the user name
> 
> I was hoping that a line like or similiar:
> 
> machine*: myaccount
> 
> would take any name matching machine* and forward onto the myaccount 
> mailbox.
> 
> man aliases didnt really help me nor did I find anything else.
> Is there a way to pattern match in /etc/aliases with an * or something?

 Not supported. Maybe doable in postfix with header_checks and REDIRECT.

 If you control the recipient address on the sending end, you could change
 it to myaccount+machine at domain and not need the alias.

 Or if you know all possible values of machine*, use a script or Makefile
 to generate a file with all these aliases and :include it in your main
 aliases file. The disadvantage is this is not maintenance-free.