I'm using sendmail to send a very simple email from a text file. Here is the text file:
to:email@example.com from:firstname.lastname@example.org subject:Testing 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:
22.214.171.124 hostname hostname.tld 127.0.0.1 localhost
Where hostname.tld is the fqdn of the server and 126.96.36.199 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 [127.0.0.1])
I don't want 127.0.0.1, 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/sendmail.mc to have the line:
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?