Configuring postfix to use smarthost

panickedprocrastinator asked:

I have an application running on centOS 7, which needs to be configured to send mail(postfix) to a third party SMTP server. I have found that a way to accomplish this is to configure a smarthost using the relayhostparameter. But how do I set a specific from address for the mails sent from this server?

My answer:

You can rewrite sender addresses with sender_canonical_maps.

For example:

sender_canonical_maps = hash:/etc/postfix/canonical

Which file will contain the canonical mappings you want, for instance:


And you generate its hash in the usual way:

postmap /etc/postfix/canonical

See the documentation for more.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.