Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Goal: Need to forward all mail destined for users @ domainA.com to users @ domainB.com.

Using GApps for domainB.com. I setup a postfix relay that domainA.com's MX records point too. Able to send mail to users @ domainA.com, but the 'From' address gets re-written to the user account the relay is set to authenticate with GApps too. How can this be prevented? I would like the From address to remain as the true 'From' address and not get re-written?

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_note_starttls_offer = yes
tls_random_source = dev:/dev/urandom
smtp_tls_scert_verifydepth = 5
smtpd_tls_ask_ccert = yes
smtpd_tls_req_ccert = no
smtp_tls_enforce_peername = no
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtpd_sender_restrictions = reject_unknown_sender_domain
smtpd_data_restrictions = reject_unauth_pipelining

virtual_alias_domains = domainA.com
virtual_alias_maps = hash:/etc/postfix/virtualmap

myhostname = machineA.localcompany.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = smtp.gmail.com, localhost, machineA.localcompany.com
relayhost = [smtp.gmail.com]:587
mynetworks =
mailbox_size_limit = 0
message_size_limit = 26214400
recipient_delimiter = +
inet_interfaces = all
share|improve this question
Postfix won't do any rewriting in that situation, as you will see when you check the maillog. The one that is to blame here, is Google. –  unixtippse Nov 13 '10 at 4:38
+1 - is auth necessary to relay mail to Gmail? It already acts as a mail relay, not so? Could you not set the MX for domainB to Gmail's SMTP server/s, and let your relay do the DNS lookup naturally? –  Zayne S Halsall Nov 13 '10 at 14:06

1 Answer 1

You specify a per domain relay host in the transport file, edit as below then postmap the file

example.com smtp:[relayserver.name]

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.