I'm setting up postfix to forward e-mails sent to a domain to outside e-mail addresses. i.e. when I get an e-mail at [email protected] it gets sent automatically to [email protected]. That's working except that when I receive the e-mail it shows the recipient at [email protected] instead of [email protected].
I know it's possible to do this because when I had e-mails forwarded using some web panel on a cheapo hosting company, it worked great. So how do I get postfix to retain the recipient address even though it's being forwarded to another address?
My config:
alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain = no biff = no config_directory = /etc/postfix home_mailbox = Maildir/ inet_interfaces = all inet_protocols = all mailbox_command = mailbox_size_limit = 0 mydestination = mydomain.com, localhost.localdomain, localhost myhostname = mx1.mydomain.com mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 myorigin = /etc/mailname readme_directory = no recipient_canonical_maps = hash:/etc/postfix/recipient_canonical recipient_delimiter = + relayhost = [smtp.mandrillapp.com] smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtp_use_tls = yes smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination 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 To be clear, when I receive the e-mail at the forwarded address, I still want it to show the To: address as having the original recipient (@mydomain.com).
postconf -ncommand) [2] Which address that do you want to keep? MAIL TO: envelope recipient or To: headers in the message itself?