I have had a postfix mail server running for some time mostly just taking mail for a couple of personal domains for me. I was recently asked if I could email services for a family member, and I'm having a bit of trouble setting everything up.
If I send a test email to dave@domaintwo.tld, it gets rewritten as david@domainone.tld. The dave->david conversion is done in the virtual map. However the domain name changes, too.
This changed second domain then gets caught in my catchall for domainone, resulting in the email going to the wrong place.
I'm sure this is something simple to do with how I've set up the virtual domains, but I think I've tried every possible combination, and can't get it to work correctly!
Any help greatly appreciated.
The error:
postfix/local[2512]: 66BD219F511: to=<david@domainone.tld>, orig_to=<dave@domaintwo.tld>, relay=local, delay=0.46, delays=0.42/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
/etc/postfix/main.cf:
mydomain = domainone.tld
smtpd_banner = $myhostname ESMTP $mail_name
biff = no
append_dot_mydomain = no
delay_warning_time = 1h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/mail.domainone.tld/cert.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mail.domainone.tld/privkey.pem
smtpd_tls_CAfile=/etc/letsencrypt/live/mail.domainone.tld/chain.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3
smtp_tls_security_level = may
smtpd_tls_mandatory_ciphers = high
myhostname = mail.domainone.tld
myorigin = $mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost, domainone.tld, domaintwo.tld, domainthree.tld, domainfour.tld
#virtual_alias_domains =
virtual_alias_maps = hash:/etc/postfix/virtual
#relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
home_mailbox = Maildir/
mailbox_command = procmail -a "$EXTENSION"
message_size_limit = 51200000
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/blacklist_recipients,
check_sender_access hash:/etc/postfix/blacklist_senders,
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client bl.spamcop.net,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client virbl.dnsbl.bit.nl
relay_domains = $mydestination, anotherserver.tld
relay_recipient_maps =
/etc/postfix/virtual:
george@domainone.tld george
test@domainone.tld george
@domainone.tld george
dave@domaintwo.tld david
@domaintwo.tld david
webmaster@domaintwo.tld george
alice@domainthree.tld alice
@domainthree.tld alice
webmaster@domainthree.tld george
aaron@domainfour.tld aaron
@domainfour.tld aaron
webmaster@domainfour.tld george
What I think happens:
- Email comes in to dave@domaintwo.tld from an external server
- virtual map matches dave@domaintwo.tld (I want server to delivery to mailbox for used david.)
- Server redirects to david@domainone.tld (domainone.tld is the server's domain)
- david@domainone.tld is then matched by @domainone.tld and delivered to user george.
This happens to any address other than george@domainone.tld.
Server details:
- postfix: mail_version = 3.1.15
- procmail: procmail v3.23pre