Postfix: Accept some mail to mailbox, and forward some mail.

Postfix: Accept some mail to mailbox, and forward some mail.

Dotan Cohen dotancohen at gmail.com
Fri Jul 5 16:16:19 IDT 2013


Hi all. I need to set up a virtual alias (forwarder) and a virtual
mailbox on the same domain. I'm using Postfix on Ubuntu Server 12.04.
Here is my setup:

$ cat /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

append_dot_mydomain = no
readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.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

myhostname = awsBeta
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = awsBeta, localhost.localdomain, , 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

virtual_mailbox_domains = someDomain.com
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

virtual_alias_domains = someDomain.com

$ cat /etc/postfix/virtual
forward at someDomain.com test at gmail.com

$ cat /etc/postfix/vmailbox
dotan at someDomain.com someDomain.com/dotan

$ sudo postmap virtual
$ sudo postmap vmailbox
$ tree /var/mail/vhosts/
/var/mail/vhosts/
└── someDomain.com
    └── dotan

When mail is sent to forward at someDomain.com it is properly forwarded
to test at gmail.com. However, when mail is sent to dotan at someDomain.com
the sending address receives a mail with this error:
Recipient address rejected: User unknown in virtual alias table

This appears in the log:
warning: do not list domain someDomain.com in BOTH
virtual_alias_domains and virtual_mailbox_domains

Of course, I cannot remove the domain from either
virtual_alias_domains or virtual_mailbox_domains because I need to use
bothe of those features. So how might one set up dotan at someDomain.com
as a real mailbox (no unix account though), but forward at someDomain.com
to forward to test at gmail.com? I've been trolling Google for answers,
but though I thought that this would be easy, I'm stuck!

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com



More information about the Linux-il mailing list