OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Forwards with MySQL

From: Alvaro Marín (alvarohostalia.com)
Date: Fri Sep 01 2006 - 04:43:40 CDT


Kai Fürstenberg wrote:

Hello,

> You can use transport_maps. Forward otheruserotherdomain.com via smtp
> to the other MX. Anyhow you should/must add this user to the table:
> "otheruser","otherdomain.com","otheruserotherdomain.com". Postfix
> always looks in the table but the alias mapping is the same. It then can
> take the transport_maps to forward the message to a different server.

I've tried with that (configuring transport table too):

mysql> select * from email_domains;
+---------------------------+
| domain |
+---------------------------+
| gmail.com |
| pruebas.domain.com |
+---------------------------+

mysql> select * from email_transports;
+-----------+----------------+
| domain | transport |
+-----------+----------------+
| gmail.com | smtp:gmail.com |
+-----------+----------------+

mysql> select * from email_aliases;
+------------+---------------------------+----------------------+
| alias_user | alias_domain | alias_dest |
+------------+---------------------------+----------------------+
| user | pruebas.domain.com | oneusergmail.com |
| oneuser | gmail.com | oneusergmail.com |
+------------+---------------------------+----------------------+

If I send an email to "userpruebas.domain.com":

to=<oneusergmail.com>, orig_to=<userpruebas.domain.com>, relay=none,
delay=0.11, delays=0.08/0.01/0/0.03, dsn=5.0.0, status=bounced (User
unknown in virtual alias table)

MySQL log:

select alias_dest from email_aliases where alias_user="user" and
alias_domain="pruebas.domain.com"
select domain from email_domains where domain="gmail.com"
select alias_dest from email_aliases where alias_user="oneuser" and
alias_domain="gmail.com"

and then, only queries (included transport table) to bounce message to root.

> This should have something to do with how you specify the MySQL-query
> and how you created the table. For MySQL it is a difference if you have
> an empty string for alias_user or if you have NULL.

I've tried with NULL, ""... and nothing :(
The table is:

mysql> desc email_aliases;
+--------------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-----------+------+-----+---------+-------+
| alias_user | char(250) | YES | | NULL | |
| alias_domain | char(250) | | | | |
| alias_dest | char(250) | | | | |
+--------------+-----------+------+-----+---------+-------+

Thanks.

Regards,
Alvaro.