Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using sendmail to send a very simple email from a text file. Here is the text file:

test test test

Which I send with:

sendmail -t < mail.txt

The server I am running sendmail from is hostname.tld. Here is /etc/hosts:     hostname hostname.tld       localhost

Where hostname.tld is the fqdn of the server and is the public IP of the server. /etc/hostname simply contains hostname.tld

When I receive the email, I get this header:

Received: from hostname.tld (hostname.tld [])

I don't want, I want the public IP to be there, but I can't get sendmail to use it no matter what I do. I've also edited /etc/mail/ to have the line:

define(`confDOMAIN_NAME', `hostname.tld')dnl

But it does nothing.

I've read so many threads where people have a similar problem but nothing seems to resolve it. What can I do?

share|improve this question

2 Answers 2

When you are sending the email using a script on your local machine, then it is received from localhost. The public IP will be shown in the next Received:-line.

share|improve this answer
Are you saying that the only way to not have is to send mail through an SMTP server, for example? Is it not possible to remove the Received line with on it at all? Setting up a dedicated mail server for what I am doing is a bit overkill, I would much rather use sendmail and just be able to get rid of that line somehow. – Cameron Ball Jun 18 '13 at 7:53
I am saying that if you are using that method of sending your mail, that is the way that sendmail will correctly create its Received-header. (I also completely fail to see why this is a problem.) – Jenny D Jun 18 '13 at 7:59
Apparently it can trigger anti-spam mechanisms on some email servers. – Cameron Ball Jun 19 '13 at 2:20
up vote 0 down vote accepted

This was my solution:

/etc/hosts :     hostname.tld       localhost

/etc/mail/ :

FEATURE(`msp', `[]', `25')dnl

(originally it had instead of my public IP)

/etc/mail/ :

DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, M=Ea, Addr=')dnl

(both of those lines originally had, changing it makes sendmail listen on your public IP instead of localhost).

Run the command:

make -C /etc/mail

Reload sendmail:

service sendmail reload

After sending my test email with:

sendmail -t < mail.txt

The header I didn't like now says:

Received: from hostname.tld (hostname.tld [])

And there's no mention of localhost or anywhere in the headers

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.