Postfix ignoring virtual alias in MySQL database, returns error "Unknown user"

0

I set up a Postfix email server over a year ago following this guide: https://www.howtoforge.com/virtual-users-and-domains-with-postfix-courier-mysql-and-squirrelmail-debian-wheezy.

The server has been trouble free since until now. Yesterday I bought a new domain name and needed to set up an email address for it. Like I've done so before, I added the domain name to the database, and created a forwarding for this new domain name to point to a mailbox held away from the server. I did a similar set up last week and this had been working.

While testing the email address yesterday, I kept getting the following bounce back email from the mail account I was sending an email from:

This is the mail system at host email.domain.com.

I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can delete your own text from the attached returned message.

               The mail system

hello@domain.co.uk: unknown user: "hello@domain.co.uk"

Thinking the MX records hadn't been updated, I left it alone until this morning. I've tried again and I receive the same message. I then thought to try the email I set up in a similar way last week and that has also stopped working, returning the same error message.

The database, as outlined in the tutorial, handles the forwarding and actual mail user accounts. These accounts are working also, having sent an email to non-forwarding email accounts held on the server. These are received without a problem.

Here is the main.cf contents:

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = email.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = email.domain.com, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transpo$
receive_override_options = no_address_mappings

I've restarted MySQL, I've reloaded and restarted Postfix, but the problem seems to still persist. Nothing to this configuration or to the server in general has been changed in the past year. Any ideas what's going on?

mickburkejnr

Posted 2016-04-12T07:24:19.363

Reputation: 1 437

Answers

1

Solved it, thankfully!

After a lot of searching, trial and error, it turns out the line:

receive_override_options = no_address_mappings

In my main.cf file was preventing the aliases in the forwarding table from being loaded in to Dovecot. Removed the line, reloaded Postfix, and it's all working nicely again!

mickburkejnr

Posted 2016-04-12T07:24:19.363

Reputation: 1 437