Postfix: How do I Make Email Aliases Work?

Posted by Nick on Server Fault See other posts from Server Fault or by Nick
Published on 2010-04-17T07:52:42Z Indexed on 2010/04/17 7:54 UTC
Read the original article Hit count: 305

Filed under:

The documentation claims that I can add aliases in a file (like /etc/postfix/virtusertable) and then use the "virtual_maps" directive to point to it. This does not appear to be working, however.

My mail is bouncing with:

Recipient address rejected: User unknown in local recipient table;

If I mail the user from the server using the mail command, it works.

mail myuser

The message goes through postfix and inserts itself in the Cyrus inbox correctly.

When I use fetchmail to get the user's messages off a pop3 server, postfix fails. The user's email is "[email protected]", but it doesn't seem to be mapping correctly to "myuser", the cyrus mailbox name.



/etc/postfix/main.cf

myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
mailbox_transport = lmtp:unix:/var/run/cyrus/socket/lmtp
#lmtp:unix:/var/run/lmtp
virtual_alias_domains = mydomain.com
virtual_maps = hash:/etc/postfix/virtusertable



/etc/fetchmailrc

et syslog;
set daemon 20;

poll "mail.pop3server.com"
with protocol pop3
user "[email protected]" password "12345" is "myuser"
fetchall keep



/etc/postfix/virtusertable

[email protected]     myuser



postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mailbox_transport = lmtp:unix:/var/run/cyrus/socket/lmtp
mydestination = localhost 
myhostname = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost = 
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_domains = mydomain.com

Why is it ignoring my alias?

© Server Fault or respective owner

Related posts about postfix