Hi everyone,
Sorry if this has been asked before I searched all over the place but I
just can't figure it out. I'm trying to setup postfix, using dovecot for
delivery (and IMAP&POP3). Dovecot in turn uses a MySQL backend. I used this
guide: http://en.gentoo-wiki.com/wiki/Mail_server_using_Postfix_and_Dovecot
Basically IMAP and POP3 are working, but when I try to send email to the
new server it fails. I tried:
- sending email from the new server to the new server (using thunderbird
via SMTP).
- sending email from my old server (this one) to the new one.
- I tried sending to both real mailboxes as well as to two aliases.

The error is always the same, here's thunderbird's version when using the
new server's SMTP: "An error occurred while sending mail. The mail server
responded: 5.1.1 <use...@schaumburger.info>: Recipient address rejected:
User unknown in virtual mailbox table. Please check the message recipients
and try again."

I should mention that I'm not exactly an expert with this stuff, but I have
successfully setup postfix before (but without dovecot) and have a fair bit
of experience with *nix administration. I used postfix 2.5.5 originally, I
tried updating to 2.5.6 just in case it was a bug but no change. I assume
this is a silly error on my part somewhere ;)
I also checked that the SQL user&pw used for this is working, all the
configs and SQL entries seem to be correct as far as I can tell.

My OS is Gentoo x86, the machine is running on a private DSL line with
DHCP-assigned IP, but port 25 is open (I verified this with telnet) and it
always assigns the same IP so I don't think that can be the problem.

I compiled/installed postfix and dovecot with Gentoo's portage with the
following options (USE flags):
mail-mta/postfix-2.5.6  USE="dovecot-sasl mysql sasl ssl -cdb -hardened
-ipv6 -ldap -mailwrapper -mbox -nis -pam -postgres (-selinux) -vda"
net-mail/dovecot-1.1.7-r1  USE="berkdb mysql pop3d ssl -debug -doc -ipv6
-kerberos -ldap -managesieve -mbox -pam -postgres -sieve -sqlite3 -suid
-vpopmail"



Any help would be greatly appreciated! If the question was answered before
I apologise but it would be nice if you could point me to the post if
possible :)
Below what I think are the relevant bits of the config files and SQL.

Here's what I changed (as in, added at the end of the file) in main.cf:
home_mailbox = .maildir/

dovecot_destination_recipient_limit = 1
virtual_transport = dovecot

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domain_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

virtual_mailbox_base = /var/mail

smtpd_client_restrictions=
 permit_inet_interfaces,
 permit_mynetworks,
 permit_sasl_authenticated,
 permit

smtpd_sender_restrictions=
 reject_non_fqdn_sender,
 permit

smtpd_reject_unlisted_sender = yes

smtpd_recipient_restrictions=
 permit_mynetworks,
 reject_non_fqdn_recipient
 permit_sasl_authenticated
 reject_unauth_destination
 permit

Here's what I added at the end of master.cf:
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=mail:mail argv=/usr/libexec/dovecot/deliver -f ${sender}
-d ${recipient}

And mysql_virtual_domain_maps.cf:
user = mailauth
password = password
hosts = localhost
dbname = postfixadmin
query = SELECT domain FROM domain WHERE domain='%s' AND backupmx = '0' AND
active = '1'

mysql_virtual_mailbox_maps.cf:
user = mailauth
password = password
hosts = localhost
dbname = postfixadmin
query = SELECT CONCAT(maildir, 'Maildir/') AS maildir FROM mailbox WHERE
username='%s' AND active = '1'

mysql_virtual_alias_maps.cf:
user = mailauth
password = password
hosts = localhost
dbname = postfixadmin
query = SELECT goto FROM alias WHERE address='%s' AND active = '1'

Finally, here's the SQL tables (I removed most of the aliases for
legibility):
davserver ~ # mysql -umailauth -ppassword postfixadmin
mysql> select * from domain; 
+-------------------+------------------+---------+-----------+----------+-------+-----------+----------+---------------------+---------------------+--------+
| domain            | description      | aliases | mailboxes | maxquota |
quota | transport | backupmx | created             | modified            |
active |
+-------------------+------------------+---------+-----------+----------+-------+-----------+----------+---------------------+---------------------+--------+
| ALL               |                  |       0 |         0 |        0 |  
  0 | NULL      |        0 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |   
  1 | 
| schaumburger.info | schaumburgerinfo |     250 |        50 |     1000 |  
  0 | virtual   |        0 | 2009-03-21 12:31:05 | 2009-03-21 12:31:05 |   
  1 | 

mysql> select * from mailbox;
+---------------------------+------------------------------------+--------------------+----------------------------+------------+-------------------+---------------------+---------------------+--------+
| username                  | password                           | name    
          | maildir                    | quota      | domain            |
created             | modified            | active |
+---------------------------+------------------------------------+--------------------+----------------------------+------------+-------------------+---------------------+---------------------+--------+
| stef...@schaumburger.info | $1$16645d81$gOvl/tM100yzK8WvDxymx. | Steffen
Schaumburg | schaumburger.info/steffen/ | 1048576000 | schaumburger.info |
2009-03-21 12:40:38 | 2009-03-26 12:38:52 |      1 | 
| ve...@schaumburger.info   | $1$5cbfc677$SPhEOsrgDCWraO/eDHJHS. | Vesna   
          | schaumburger.info/vesna/   | 1048576000 | schaumburger.info |
2009-03-25 20:23:57 | 2009-03-25 20:23:57 |      1 | 

mysql> select * from alias where address="use...@schaumburger.info";
+--------------------------+---------------------------+-------------------+---------------------+---------------------+--------+
| address                  | goto                      | domain           
| created             | modified            | active |
+--------------------------+---------------------------+-------------------+---------------------+---------------------+--------+
| use...@schaumburger.info | stef...@schaumburger.info | schaumburger.info
| 2009-03-21 12:31:05 | 2009-03-21 12:31:05 |      1 | 

Thanks for making it this far and TIA for any help/pointers :)
Steffen

Reply via email to