Discussion:
Postfix - virtual_alias_domains - MySQL
(too old to reply)
Matt Salerno
2005-04-11 21:30:28 UTC
Permalink
I am looking for some assistance on setting up the
virtual_alias_domains table in SQL. I have read through the postfix
docs, but what I have so far doesn't work. Basically I need to alias a
few different domains, which is much easier than adding a new alias
for every user of every virtual domain. There are many different
virtual domains hosted on this server, with many users per domain, and
my company decided that it wanted to buy the .org and .net for all of
the hosted domain names. Hence my question.

http://www.postfix.org/mysql_table.5.htmlPostfix docs wrote:
When using SQL to store lists such as ..., it is important to
understand that the table must store each list member as a separate
key.


Code:

+----------+-----------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-----------------+------+-----+---------------------+-------+
| domain | varchar(30) | | PRI | | |
| primary | varchar(30) | | | | |
| added | datetime | | | 0000-00-00 00:00:00 | |
+----------+-----------------+------+-----+---------------------+-------+

So basically, I'll populate the table with:

insert into virtual_alias_domains Values ('foo.org','foo.com',NOW());

Setting, or at least trying to set foo.org as an alias of foo.com.

The next step will be pointing postfix to look at the table.

main.cf:
virtual_alias_domains = mysql:/etc/postfix/sql-virtual_alias_domains.cf

sql-virtual_alias_domains.cf:
user = dbmail
password = mypassword
hosts = localhost
dbname = dbmail
table = virtual_alias_domains
select_field = domain
where_field = primary

When I set all of this up, and I send an e-mail to ***@foo.org I
get the following error in my logs:

[postfix/trivial-rewrite] warning: mysql query failed: You have an
error in your SQL syntax. Check the manual that corresponds to your
MySQL server version for the right syntax to use near 'primary =
'foo.com'' at line 1
[postfix/trivial-rewrite] fatal:
mysql:/etc/postfix/sql-virtual_alias_domains.cf(0,100): table lookup
problem

I'm hoping that someone out there can help me spot the problem.

Thanks,

Matt
Victor Duchovni
2005-04-11 21:39:46 UTC
Permalink
Post by Matt Salerno
I am looking for some assistance on setting up the
virtual_alias_domains table in SQL. I have read through the postfix
docs, but what I have so far doesn't work. Basically I need to alias a
few different domains, which is much easier than adding a new alias
for every user of every virtual domain. There are many different
virtual domains hosted on this server, with many users per domain, and
my company decided that it wanted to buy the .org and .net for all of
the hosted domain names. Hence my question.
When using SQL to store lists such as ..., it is important to
understand that the table must store each list member as a separate
key.
+----------+-----------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-----------------+------+-----+---------------------+-------+
| domain | varchar(30) | | PRI | | |
| primary | varchar(30) | | | | |
| added | datetime | | | 0000-00-00 00:00:00 | |
+----------+-----------------+------+-----+---------------------+-------+
insert into virtual_alias_domains Values ('foo.org','foo.com',NOW());
Get the system working with indexed files first, then replicate with
mysql! In doing this you will discover that virtual_alias_domains is
not a mechanism for aliasing domains.

http://www.postfix.org/VIRTUAL_README.html
--
Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:***@postfix.org?body=unsubscribe%20postfix-users>
Loading...