0

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?

topskip
  • 53
  • 4

2 Answers2

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.

Depending on your volume you could use a service like Mandrill, Linode has some documentation on how to set that up here: https://www.linode.com/docs/email/postfix/postfix-smtp-debian7

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

http://help.mandrill.com/entries/23374656-Can-I-send-emails-on-behalf-of-my-clients-

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

+And there's a Wordpress Plugin (wpMandril)

Jacob Evans
  • 7,886
  • 3
  • 29
  • 57
1

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.

krugger
  • 411
  • 2
  • 4
  • 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