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

I have several ubuntu servers / desktops running on the same machine using kvm (under ubuntu server 12.04)

With postfix on each virtual machine I've redirected each root's mail to my gmail account.

Everything works fine,

The problem comes that some daemons send notifications without identifying the machine name. So, when I get the email, I dont know which virtual machine has sent it.

Is there any way with postfix conf to add a custom text like "asterisk_server:" before the subject, to identify the comoputer from the email has been sent?

Many thanks

share|improve this question

Your premise is incorrect: it is not postfix, or the machine, that sends email without identifying host information; it is the process sending the mail.

That said, not all processes can properly set the hostname on submission; for such non-compliant clients, set myorigin to a decent value for your environment, and add

append_at_myorigin = yes


For instance, if each VM's postfix instance has myorigin = $myhostname, this will convert ANY addresses without host or domain information to user@$myhostname. This uniquely identifies both sender and recipient.

HOWEVER, each VM does not need to run postfix, and truth be told, probably should not run postfix.

Instead, configure a nullclient to submit mail to one MSA (which may be postfix), and deal with all mail on the one centralized server.

share|improve this answer
The thing here is that there are MANY processes that need to make use of mail facilities ex. cron (anacron), logrotate, custom report scripts etc. Custom specifying each one may not be the best option. As an alternative we can set up Postfix in send_only mode and then expose the client root (or other) user from which the message is coming. – ank May 16 '12 at 13:28
It doesn't matter which or how many processes want to send mail; if you use a nullmailer to submit mail then that is where the sender can be set. – adaptr May 16 '12 at 13:44
+1 for the nullmailer. – Oliver May 16 '12 at 14:09

I would try header_checks with REPLACE Subject

share|improve this answer

You can try something of this sort:

default_database_type = cdb
indexed = ${default_database_type}:${config_directory}/
smtp_generic_maps = ${indexed}generic

# Expose which root sent the mail
root root+<hostname>

Note that I have not tried this since I do not expose the root user in my set ups.

share|improve this answer
How does such a convoluted (and ultimately non-working) configuration help ? – adaptr May 16 '12 at 12:42
Well, I went ahead and tried this for you and not only it works, it works like a charm (only two lines of configuration). Also note that the above method uses default facilities found in Postfix ie. the smtp_generic_maps parameter. The rest is just bells and whistles. Please do read the second part. Additionally, as a bonus, you cannot reply to the FROM address, simply there is no such user. – ank May 16 '12 at 13:21
@adaptr1 Sorry you have to be so arrogant when your hasty reply is proven wrong. And, for the sake of completion, Postfix in send_only mode is "nullmailer" named Postfix since its incoming process is completely disabled, actually does not bind to the net interface at all. For some of us using Linux distributions (ex. RedHat) installing unsupported software is not always an option. So now you know. – ank May 16 '12 at 15:42

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.