1 (edited by zeussn 2009-06-29 21:23:44)

Topic: Postfix Aliases

Hi, this maybe a little offtopic question but I search for a while and I didn't find any solution, so here is the question :

Is it possible to create an Alias like "all@domain.com" to send an email to all the users of a domain ?

I tried creating an alias on Postfix.Admin with the name "all" and the destionation "*" but the postfix log said "user unknown".

BTW, I'm running iRedMail 0.5.0-rc1 with mySQL.


Re: Postfix Aliases

Maybe you can try the way below (it's used in LDAP solution, but not tested & used in MYSQL solution yet):

# table: vmail.mailbox
# Columns: username, memberOfGroup
www@domain.com all@domain.com

And add one more virtual_alias_maps lookup file, make it search memberOfGroup column.

PS: you have to add 'memberOfGroup' column manually.


Re: Postfix Aliases

Ok, but using that method I have to add all the users, one by one, or can I do some kind of regex like *@domain.com ?


Re: Postfix Aliases

zeussn wrote:

Ok, but using that method I have to add all the users, one by one, or can I do some kind of regex like *@domain.com ?

Not tested yet. Why not give it a try by yourself? smile

PS: i think you can add 'all@domain.ltd' during adding 'memberOfGroup' column:

mysql> ALTER TABLE mailbox ADD memberOfGroup VARCHAR(255) NOT NULL DEFAULT 'all@domain.ltd';

Note: Maybe VARCHAR(255) is not what you need, change it to the type you need.


Re: Postfix Aliases

Hi again,

  I just tried this solution and for me it work great.

Here are the changes I made :


Replace : virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
For this : virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_maps_custom.cf

Copy /etc/postfix/mysql_virtual_alias_maps.cf to mysql_virtual_alias_maps_custom.cf.


Replace : query       = SELECT goto FROM alias WHERE address='%s' AND active='1' AND expired >= NOW()
For this : query       = SELECT username FROM mailbox WHERE memberOfGroup ='%s' AND active='1' AND expired >= NOW()

And in the mySql database just add the field 'memberOfGroup' on the mailbox table.