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'm using Postfix 2.3.3 and mail sent from my server always add useless headers which I'd like to remove. Currently I'm only using the PHP mail() function to send mail.

Received: from (localhost.localdomain [])
 by (Postfix) with ESMTP id EBAF41540011
 for ; Mon,  7 Dec 2009 16:59:02 +0000 (GMT)
Received: from ( [70.87.x.x])
 by (Postfix) with ESMTP
 for ; Mon,  7 Dec 2009 16:59:02 +0000 (GMT)
Received: from (unknown [x.172.x.x])
 by (Postfix) with ESMTP id 6B20F56063B
 for ; Mon,  7 Dec 2009 16:59:02 +0000 (GMT)
Received: from ( [])
 by (Postfix) with ESMTP id 1E5B018080AC
 for ; Mon,  7 Dec 2009 11:59:02 -0500 (EST)
Received: (from apache@localhost)
 by (8.13.8/8.13.8/Submit) id nB7Gx2lR016074;
 Mon, 7 Dec 2009 11:59:02 -0500

I've compared mine to Gmail headers and from what I've seen are the last two useless headers. Also how do I change the return path from within the Postfix configuration?

share|improve this question
up vote 5 down vote accepted

FWIW, this is a bad idea for Received headers but here's the answer anyways. womble mentioned content_filter as a recommended solution. IMHO that's overkill, Postfix supports this natively via header_checks.


header_checks = regexp:/etc/postfix/header_checks


/^Received:.*\[127\.0\.0\.1\]/         IGNORE
/^Received:.*\from apache@localhost/   IGNORE
share|improve this answer
So far so good! How can I change the return path to a valid address in the postfix configuration? Because It's annoying that it uses something like apache@localdomain.local – EarthMind Dec 8 '09 at 15:26
Configure your Postfix server correctly and set appropiate values for myhostname, mydomain and myorigin – Philip Reynolds Dec 8 '09 at 17:57
I've set them abut unfortunately it's not working. mydomain = myhostname = myorigin = – EarthMind Dec 8 '09 at 21:49

Every header is useless -- until the day you really actually need that information to diagnose some irritating problem.

If you're dead-set on doing this, then you want to look at the content_filter parameter.

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.