Virtual alias with dovecot

Jorge Bastos mysql.jorge at decimal.pt
Fri Nov 7 23:44:52 UTC 2014


Hi,

 

I've setup virtual alias/users/domains with postfix and dovecot, so far so
good.

 

In the alias table I set the information of the source and destination
address, but then I try to send an email to the alias, dovecot complains
about it.

 

What am I doing wrong?

 

Nov  7 23:04:13 fastmail dovecot: lmtp(4687): Connect from local

Nov  7 23:04:13 fastmail postfix/lmtp[6556]: 1D2AC100E0A: to=<b at a.com>,
relay=fastmail.domain.pt[private/dovecot-lmtp], delay=6.3,
delays=6.2/0/0/0.06, dsn=5.1.1, status=bounced (host
fastmail.domain.pt[private/dovecot-lmtp] said: 550 5.1.1 <b at a.com> User
doesn't exist: b at a.com (in reply to RCPT TO command))

Nov  7 23:04:13 fastmail dovecot: lmtp(4687): Disconnect from local:
Successful quit

 

Postfix alias conf:

 

virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf

 

cat mysql-virtual-alias-maps.cf

user = posuser

password = popass

hosts = 127.0.0.1

dbname = postfix

query = SELECT deliver_to FROM dovecot_aliases WHERE alias='%s'

 

 

where the table structure is:

CREATE TABLE `dovecot_aliases` (

  `id` int(11) NOT NULL,

 `alias` varchar(255) NOT NULL,

  `deliver_to` varchar(255) NOT NULL,

  PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

 

Records are, considering that the main address is a at a.com:

 

Insert into dovecot_alias values (1,'b at a.com','a at a.com');

 

Should be postfix that should had send this to the main address right? What
could be wrong?

SQL Logs for this, show's that dovecot considered the alias to check if the
users exists instead of the real address:

 

141107 23:18:12    45 Connect   postfix_usr at localhost on postfix

                   45 Query     SELECT deliver_to FROM dovecot_aliases WHERE
alias='ola.pt'

                   46 Connect   postfix_usr at localhost on postfix

                   46 Query     SELECT 1 FROM dovecot_domains WHERE
domain='ola.pt' and status='true'

141107 23:18:16    45 Query     SELECT deliver_to FROM dovecot_aliases WHERE
alias='a.com'

                   46 Query     SELECT 1 FROM dovecot_domains WHERE
domain='a.com' and status='true'

                   47 Connect   postfix_usr at localhost on postfix

                   47 Query     SELECT deliver_to FROM dovecot_aliases WHERE
alias='b at a.com'

141107 23:18:22    45 Query     SELECT deliver_to FROM dovecot_aliases WHERE
alias='a.com'

                   46 Query     SELECT 1 FROM dovecot_domains WHERE
domain='a.com' and status='true'

                   48 Connect   postfix_usr at 192.168.69.223 on postfix

                   48 Query     select uid,gid from dovecot_users where
username='b at a.com'

                   49 Connect   postfix_usr at localhost on postfix

                   49 Query     SELECT deliver_to FROM dovecot_aliases WHERE
alias='ola at ola.pt'

                   49 Query     SELECT deliver_to FROM dovecot_aliases WHERE
alias='@ola.pt'

                   45 Query     SELECT deliver_to FROM dovecot_aliases WHERE
alias='ola.pt'

                   46 Query     SELECT 1 FROM dovecot_domains WHERE
domain='ola.pt' and status='true'

 

PS: offtopic, don't understand why postfix queries the sender domain in the
domains table and the sender email in the alias table.

 

Thanks in advanced,

Jorge,



More information about the dovecot mailing list