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

As a newbie Postfix user, I've gotten so far and now I am stuck with a SMALL problem.

I would like to configure my local network servers to send alerts and like using the following:

  1. From address:
  2. From name: Hostname

I can get #1 to work fine using smtp_generic_maps

The problem is that on my email client, the name is listed as "root" - as in the header shows the following:

Date: Sun, 29 Jul 2012 13:21:01 -0400 (EDT)
From: (root)
To: undisclosed-recipients:;

I'd like to change it to From: (Zeus)

I imagine that this can be done in the headers_check, but so far I haven't gotten anything to work and before I waste a ton of time trying to get this to work, I'd like to make sure I am on the right track.

My aliasing and generic_maps are set up correctly (As far as I can see and know - the results are correct!). I just want to change that last bit in the From field to reflect the hostname.

I would also like to add something in the subject of the outgoing messages for easy filtering - something like Subject: [Zeus.domain] - "Original Subject".

share|improve this question
up vote 2 down vote accepted

This is not a job for the MTA; it should be done by the mail client.

Postfix is merely reporting the From: header as passed along by the client; in this case, porbably cron thorugh sendmail(1), which sets the friendlyname to the original sender (system user "root")

Why not have each servers' processes send mail to a designated local system account, and then process that and forward it to wherever you want ?

This allows you to modify each machine's outgoing email while avoiding the (unnecessary) mangling of a central MTA.

share|improve this answer
Okay - based on your suggestion I changed the friendly name to something more along the lines of what I wanted. If there was a case which I could not do this and had control, what could I do to "force" this change in the MTA? – JTWOOD Aug 1 '12 at 10:54
ITYM "had NO control over the clients", because it doesn't make sense otherwise. In that case, you would have to use header_checks. – adaptr Aug 2 '12 at 8:14
I don't have any control over the one daemon sending emails - it seems to be hardcoded to send to the box administrator, which in this case is root. By changing the friendly name of root to "SERVERNAME" I at least don't have every box with this daemon sending me email from 'root' - instead it shows up as 'SERVERNAME'. -- The minus is that I never actually got header checks to work. The regex I used functioned fine using other tools on command line, but nothing ever replaced. I accept your solution because I absolutely agree - mucking about with header_checks is a major PITA for this case. – JTWOOD Aug 6 '12 at 14:48
  1. Change e-mail address:

    • vi /etc/postfix/generic

      root     myname@domain.tld
    • vi /etc/postfix/

      smtp_generic_maps = hash:/etc/postfix/generic
    • postmap /etc/postfix/generic

    • postfix reload
  2. Change name - change name in passwd file from root to My Name:

    • vi /etc/passwd:

      root:x:0:0:Own Name:/root:/bin/bash
share|improve this answer

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.