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.

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 main.cf 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

2 Answers 2

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.

share|improve this answer

You can setup a mapping in postfix by defining a smtp_generic_maps file: http://www.postfix.org/postconf.5.html#smtp_generic_maps

Or just fix it client side: echo foo | mail -aFrom: superman@google.com -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

 
discard

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.