Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Postfix mail server set up. I have one account credentials entered in. The mail server is sending mail through the Google Apps mail servers. So in a postfix config file I have my gmail credentials as:

In my PHP application I use the mail() function to send mail.

Everything works, except no matter what I set the 'from' header address to, it ALWAYS says it is coming from

I have used other setups where the email's 'from' header could be altered, so that I could have,, etc..

Any help would be greatly appreciated in how to set this up.

share|improve this question
up vote 1 down vote accepted

You can't change that at the Postfix level. Postfix already does what you want. Google replaces the sender with the authorized account. This is a "feature" of Google Apps to disallow the forging of senders.

Edit: If you don't change Google Apps, then you have to change Postfix' behavior.

In edit or add:

sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relayhost
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp_relayhost_auth
smtp_sasl_security_options = noanonymous
smtp_sender_dependent_authentication = yes

in /etc/postfix/sender_relayhost put:          []          []

in /etc/postfix/smtp_relayhost_auth put

and so on.

share|improve this answer
Are you familiar with a way in Google Apps to change this? If not, how can I add more authorized accounts in Postfix? I only know how to set one account. – donutdan4114 Oct 30 '11 at 20:20
@donutdan4114 It is somewhere in the Google Apps help. Found it two weeks ago but lost the link. – mailq Oct 30 '11 at 20:28
@donutdan4114 Researched: – mailq Oct 30 '11 at 20:30
Will check out when I have power again, and see if this does what I need – donutdan4114 Nov 1 '11 at 0:25
Thank you! I got it working with your solution. – donutdan4114 Nov 3 '11 at 22:14

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.