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

Running Debian wheezy, I have exim4 configured to use smarthost smtp.gmail.com::587
My Google Apps email address and password are configured in /etc/exim4/passwd.client and mail is being sent OK...

However, when (the recipient) looks at the email header, the following information is there:
     Received: from root by hostname.mydomain.com with local (Exim 4.80)

Even the userID of the sender is included in the "From:" section and is displayed to the client:
     From: root <no-reply@mydomain.com>

How do I ensure no information identifying the userID and hostname is contained in the email header? can this information be removed or made into something generic like localhost.mydomain.com? I do not want the sender's userID displayed in the From: section, I want only the return-path email address.

Thanks, any help is appreciated.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can't eliminate that data because it is provided not via headers but rather at connection stage and is mandatory for secure SMTP session. Let's look at usual SMTP-session:

/usr/home/me > telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 хххх.rv.ua ESMTP SERVER - Sat, 21 Dec 2013 15:43:31 +0200
HELO me@some.tld
250-хххх.rv.ua Hello me@some.tld [127.0.0.1]
MAIL FROM: me@some.tld
250 OK
RCPT TO: root@хххх.rv.ua
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Fuzzy-Header-Just-For-Fun: wow!
Subject: Manually generated message
Header-Notice-About-SMTP: next line should be empty to seperate headers from body

Here message body begins
And lasting more and more
.
250 OK id=1VuMqq-0006Zc-5W
QUIT
221 хххх.rv.ua closing connection
Connection closed by foreign host.
/usr/home/me >

As you can see, receiving MTA ask for sender email in the HELO. MTA can check is that email is valid. If sender's email provided in the HELO is illegal then most MTA are treat that message as spam. Also, MTA knows IP-address and hostname of sender just from network connection? and you can't hide that information. As result the next file has been dropped into the receiver mailbox:

Return-path: <me@some.tld>
Envelope-to: root@xxxx.rv.ua
Delivery-date: Sat, 21 Dec 2013 15:46:24 +0200
Received: from [127.0.0.1] (helo=me@some.tld)
        by xxxx.rv.ua with esmtp (Exim 4.82 (FreeBSD))
        (envelope-from <me@some.tld>)
        id 1VuMqq-0006Zc-5W
        for root@xxxx.rv.ua; Sat, 21 Dec 2013 15:46:24 +0200
Fuzzy-HEader-Just-For-Fun: wow!
Subject: Manually generated message
Header-Notice-About-SMTP: next line should be empty to seperate headers from body
Message-Id: <E1VuMqq-0006Zc-5W@xxxx.rv.ua>
From: me@some.tld
Date: Sat, 21 Dec 2013 15:45:41 +0200

Here message body begins
And lasting more and more

Here we can see the difference between data manually provided within SMTP session and data automatically added by receiving MTA.

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.