14

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 "myuser@mydomain.com", 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 "myuser@mydomain.com" password "12345" is "myuser"
fetchall keep



/etc/postfix/virtusertable

myuser@mydomain.com     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?

Nick
  • 4,503
  • 29
  • 69
  • 97

2 Answers2

22

Local aliases go into

alias_database = hash:/etc/aliases (not in /etc/postfix/virtusertable) in the following format:

alias: destination. After that run newaliases.

solefald
  • 2,301
  • 15
  • 14
  • I'm getting a warning: "warning: /etc/aliases, line 3: name must be local". I added the entry "user@mydomain.com: user" into /etc/aliases. the user isn't a user on the machine, it's a Cyrus mailbox/user. – Nick Apr 17 '10 at 08:34
  • 3
    No, the correct format is **user: anotheruser@domain.com, localuser** – David Rickman Apr 17 '10 at 09:01
  • Ok, changed the format and the warning went away, but mail is still bouncing. I'm getting "550-Mailbox unknown". – Nick Apr 17 '10 at 09:28
  • It seems like Fetchmail is accepting the message, trying to send it on to Cyrus, but now Cyrus is bouncing it. I'm thinking that postfix isn't sending it in with the right alias? Or does Cyrus need it's own alias table? – Nick Apr 17 '10 at 20:28
  • I'm going to mark this as solved, and create a new question for the Cyrus issue, since technically it's a different question. – Nick Apr 17 '10 at 20:43
  • Ok, figured it out: you set the alias in /etc/fetchmailrc using "smtpname", not in /etc/aliases. – Nick Apr 17 '10 at 22:40
0

Just ran into this issue... and found that oddly enough my issue was not cyrus related...

As I could deliver direct including "+" addresses but aliased addresses were getting rejected... FYI what I found is the alias addresses were getting rewritten. [myalias] became [myalias@myhost.mydomain.tld]

So until I figured out how to turn the expansion off or change it to drop [myhost], workaround was to expand in aliases file [myalias@mydomain.tld] instead of [myalias]

Finally stumbled on it when I finally noticed the log showing FQDN instead of just the domain as I used to in sendmail.

Gryu
  • 499
  • 1
  • 6
  • 14
Robert
  • 1