Postfix alias [user unknown] issue

aliasemailemail-serverpostfix

So I need to create an alias on my postfix server that will redirect all mail to multiple email addresses.

I have postfix + postfixadmin with dovecot up and configured and everything seem to be working just fine and server is able to receive email and send email, so does creating new accounts, but not aliases.

When attempting to send email to newly created alias (created via postfixadmin), in /var/log/mail.log I see following

Mar 11 14:24:53 somedomain postfix/pipe[28581]: B1FEDBC0899: to=<testing@somedomain.com>, relay=dovecot, delay=0.68, delays=0.63/0/0/0.05, dsn=5.1.1, status=bounced (user unknown)
Mar 11 14:24:53 somedomain postfix/cleanup[26467]: 3B549BC0BE4: message-id=<20140311102453.3B549BC0BE4@somedomain.com>
Mar 11 14:24:53 somedomain postfix/bounce[28583]: B1FEDBC0899: sender non-delivery notification: 3B549BC0BE4

And email is bounced back with pretty much same error.

Problem is that alias exists and I can see it MySQL database and in postfixadmin interface.

root@someserver:~# postconf | grep alias
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_mail_to_commands = alias, forward
allow_mail_to_files = alias, forward
expand_owner_alias = no
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
newaliases_path = /usr/bin/newaliases
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 $transport_maps $mynetworks $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps
unknown_virtual_alias_reject_code = 550
virtual_alias_domains = $virtual_alias_maps
virtual_alias_expansion_limit = 1000
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/mysql_virtual_alias_domain_catchall_maps.cf
virtual_alias_recursion_limit = 1000
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/mysql_virtual_alias_domain_mailbox_maps.cf

and some more info that may be of interest

myhostname = somedomain.com
mydestination = localhost.$mydomain, localhost, mail.somedomain.com
relayhost =

/etc/aliases file

# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
clamav: root
testing: info

althrough, without that testing line, email doesnt even bounce back

I can assure that virtual alias maps files are configured correctly, and mysql details are specifield there correctly but if needed, on request, I can provide them.

in /etc/postfix/master.cf
the following line is added

dovecot   unix  -       n       n       -       -       pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}

in /etc/dovecot/dovecot-sql.conf

driver = mysql
connect = host=localhost dbname=postfixadmin user=postfixadmin password=somepassword
default_pass_scheme = MD5
password_query = SELECT password FROM mailbox WHERE username = '%u'
user_query = SELECT maildir, 125 AS uid, 125 AS gid, CONCAT('maildir:storage=', FLOOR( quota / 1024 ) ) AS quota FROM mailbox WHERE username = '%u' AND active = '1'

in /etc/postfix/mysql_virtual_alias_maps.cf

user = postfixadmin
password = somepassword
hosts = 127.0.0.1
dbname = postfixadmin
query = SELECT goto FROM alias WHERE address='%s' AND active = '1'
#expansion_limit = 100

I am running out of ideas, what could the issue be in so any help is very much appreciated, thank you!

Best Answer

The problem, as indicated, is that dovecot has no idea who the alias is, because it is not actually an email account. postfix should be telling it which account(s) to deliver it to. Either your mysql_virtual_alias_maps (if the user is in the virtual domains) or /etc/aliases is not expanding, and the alias (instead of the actual mailbox) is being passed to dovecot.

Edit: In fact, there was an option set in Screatch's main.cf receive_override_options = no_address_mappings which is often used to prevent aliases (and other mappings) from being expanded before being passed to content filters. In his case, there was no content filter, and this was preventing his aliases from being expanded before postfix passed it to dovecot to deliver.