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 trying to hide the client IP from emails sent from postfix.

here is an example of what I mean:

Received: from mail.[removed].com ( [])
    (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
    (No client certificate requested)
    by mail.[removed].com (Postfix) with ESMTP id D50C7BF185DD
    for <[removed]>; Thu,  2 Aug 2012 16:14:21 +0900 (JST)
Date: Thu, 02 Aug 2012 07:14:08 +0000

Notice this line ( [])

I want to remove that line from the email.

I've tried doing this:

/etc/postfix/ :

smtp_header_checks = regexp:/etc/postfix/smtp_header_checks

smtp_header_checks :

/^((.*) [(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])])/    IGNORE

But my IP address is still inside of the received part of the email. If I send email off the smtp server locally the IP address becomes localhost.localdomain []

How can I remove client IPs from the header?

share|improve this question
up vote 6 down vote accepted


smtp_header_checks = pcre:/etc/postfix/smtp_header_checks


# Use your real path to, below
pcre    /usr/lib/postfix/           dict_pcre_open

You should put this in your /etc/postfix/smtp_header_checks:

/^Received: .*/     IGNORE
/^X-Originating-IP:/    IGNORE

Then run

# /etc/init.d/postfix reload
share|improve this answer
My ip address is still displayed. I appreciate the efforts. – Kyle Aug 2 '12 at 7:43
It is not necessary to have postfix-pcre. Regexp works the same way. – Kyle Aug 2 '12 at 7:45
Alright. I have made sure pcre was install on the system. I have changed regexp:/etc/postfix/smtp_header_checks to pcre:/.... I have then restarted postfix and monitored maillog for any errors. No errors were displayed. The email still displays my ip. XD Thanks for the efforts, Mike. – Kyle Aug 2 '12 at 7:51
Hmm... I get an error but I found this I tested the regex with this using argument: postmap -q "Received: from mail.[removed].com ( [])" pcre:/etc/postfix/smtp_header_checks and the output was IGNORE so it is working. However it is not making changes in the email... Is the field inside wrong? – Kyle Aug 2 '12 at 7:57
No worries at all, I actually had them mixed up in my answer too... perhaps contributing to the problem – Mike Pennington Aug 2 '12 at 8:04

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.