Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 use postfix on a debian server and I have it configured to use gmail as a smarthost (hope I've got that right).

How can I set the From: address on my outgoing mails? I need to change that on every occasion. (Background: a wordpress blog contact form plugin sets the from address but that gets changed to my google app address.)

Example: when I run echo foo | mail -s subject some@email.address the From name is always the one of my google account.

This is part of my from postfix, if this helps.

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtp_tls_security_level = may

Any other information I should provide?

share|improve this question

Google does something special, when you authenticate your from and source headers are re-written as if you were writing the email from your gmail webmail.

If you want to have a smarthost, either buy one or just send out of your server (assuming it is either a VPS or on a business class internet line) or create your own.

Depending on your volume you could use a service like Mandrill, Linode has some documentation on how to set that up here:

I would also recommend looking into SPF and DKIM, these are message authentication methods that assist in increasing delivery success.

If you are worried about spam and blacklists, you are better off sending via a smart-host with a higher/better reputation (research on vs adding outbound email services to your web host.

+And there's a Wordpress Plugin (wpMandril)

share|improve this answer

You can setup a mapping in postfix by defining a smtp_generic_maps file:

Or just fix it client side: echo foo | mail -aFrom: -s subject some@email.address

or some other configuration in the wordpress that defines the from address.

share|improve this answer
With the generic maps configuration I need to know the from: address in advance, right? I don't have this information. And the -a header flag didn't work, I still get my google from: address in the mail, and no mentioning of "superman" in any header field. – topskip Apr 17 '13 at 17:30

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.