Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

Return-Path: 
Received: from mss-us4.mail.pw (localhost.localdomain [127.0.0.1])
 by mss-us4.mail.pw (Postfix) with ESMTP id EBAF41540011
 for ; Mon,  7 Dec 2009 16:59:02 +0000 (GMT)
Received: from mx2.mail.pw (inbound-us2.mail.pw [70.87.x.x])
 by mss-us4.mail.pw (Postfix) with ESMTP
 for ; Mon,  7 Dec 2009 16:59:02 +0000 (GMT)
Received: from mail.domain.org (unknown [x.172.x.x])
 by mx2.mail.pw (Postfix) with ESMTP id 6B20F56063B
 for ; Mon,  7 Dec 2009 16:59:02 +0000 (GMT)
Received: from ip1.domain.org (ip1.domain.org [127.0.0.1])
 by mail.domain.org (Postfix) with ESMTP id 1E5B018080AC
 for ; Mon,  7 Dec 2009 11:59:02 -0500 (EST)
Received: (from apache@localhost)
 by ip1.domain.org (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

2 Answers 2

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.

/etc/postfix/main.cf:

header_checks = regexp:/etc/postfix/header_checks

/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
1  
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 = domain.org myhostname = mail.domain.org myorigin = domain.org –  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

 
discard

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.