You are here

Changing the sender address using Postfix

6 posts / 0 new
Last post
Gil Falkovitch
gilfalko's picture
Changing the sender address using Postfix

Hi

All emails are being sent using nagios@domain.net.

How do I change them to "Opsview Master <opsview@domain.net>" ?

Thanks

 

Duncan Ferguson
dferguson's picture
Postfix address rewriting

I would recommend you use postfix canonical address mapping. Two useful guides are here:

http://www.postfix.org/ADDRESS_REWRITING_README.html
http://www.postfix.org/postconf.5.html

The basics are to edit main.cf and add a reference to the map file:

sender_canonical_maps = hash:/etc/postfix/canonical

Then edit the /etc/postfix/canonical file and add the remappings:

nagios opsview@server.com

Run the command:

postmap hash:/etc/postfix/sender_canonical_maps

Then restart postfix.

  Duncs

nayax
nayax's picture
That only changes the address, not the name

How do I add the name "Opsview Master"?

 

Thanks!

Duncan Ferguson
dferguson's picture
The name should be taken out

The name should be taken out of the GCOS field in /etc/passwd for the user

  Duncs

nayax
nayax's picture
But it's not...

I'm receiving an "empty" name.

meaning the sender is "opsview-master@domain.com",

not "Opsview Master <opsview-master@domain.com>".

Following is my /etc/passwd:

nagios:x:999:998:Opsview Master,,,:/var/log/nagios:/bin/bash
opsview:x:998:997:opsview:/opt/opsview:/bin/bash

Duncan Ferguson
dferguson's picture
Can you post all of the email

Can you post all of the email headers here?  I am currently wondering if the 'nagios' user is the correct account to modify as it might be send from root when using sendmail directly - the email headers may help show this.

  Duncs