I'm having a problem with Postfix and virtual hosting. I'm also using MySQL to store my values.
Whenever I try to send an email to what should be a valid user, I get the following message in my maillog (email addys and domains removed to protect the innocent):
Code:
connect from destination.domain[xx.xxx.xxx.xxx]
NOQUEUE: reject: RCPT from destination.domain[xx.xxx.xxx.xxx]: 554 <recipient@recipient.domain: Recipient address rejected: Access denied; from=<sender@destination.domain> to=<recipient@recipient.domain> proto=ESMTP helo=<destination.domain>
lost connection after RCPT from destination.domain[xx.xxx.xxx.xxx]
disconnect from destination.domain[xx.xxx.xxx.xxx]
I have the following setup in my main.cf:
Code:
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:501
virtual_gid_maps = static:501
virtual_mailbox_base = /usr/local/vmail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_transport = virtual
smtpd_recipient_restrictions=permit_sasl_authenticated, permit_mynetworks, reject
mysql_virtual_domains_maps.cf:
Code:
user = postfix
password = postfix
hosts = localhost
dbname = maildb
table = domain
select_field = description
where_field = domain
mysql_virtual_mailbox_maps.cf:
Code:
user = postfix
password = postfix
hosts = localhost
dbname = maildb
table = mailbox
select_field = maildir
where_field = username
and mysql_virtual_alias_maps.cf:
Code:
user = postfix
password = postfix
hosts = localhost
dbname = maildb
table = alias
select_field = goto
where_field = address
I've set MySQL to log sql statements, and here is what it logs for this event:
Code:
postfix@localhost on maildb
SELECT goto FROM alias WHERE address='destination.domain'
postfix@localhost on maildb
SELECT description FROM domain WHERE domain='destination.domain'
SELECT goto FROM alias WHERE address='recipient.domain'
SELECT description FROM domain WHERE domain='recipient.domain'
That final SQL statement returns a single row.
Thanks in advance.
Bryce