5

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?

2 Answers 2

12

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
3
  • 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
    – aardbol
    Dec 8, 2009 at 15:26
  • 2
    Configure your Postfix server correctly and set appropiate values for myhostname, mydomain and myorigin Dec 8, 2009 at 17:57
  • I've set them abut unfortunately it's not working. mydomain = domain.org myhostname = mail.domain.org myorigin = domain.org
    – aardbol
    Dec 8, 2009 at 21:49
7

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.