I am trying to set my email FROM header field each time I send an email.
First I create a text file:
To: myemail@gmail.com
Content-Type: text/plain; charset=us-ascii>
From: sender@domain.com
Subject: nothing special
Main body here
Some other info
bye
The I send it with sendmail using:
cat testMail.txt | ./sendmail -t myemail@gmail.com
The mail is successfully sent. However, it is then returned by google with the error message:
Your email has been blocked because the
sender is unauthenticated. Gmail requires all senders to
authenticate with either SPF or DKIM. Authentication results: DKIM = did not pass SPF
[localhost.localdomain] with ip: [my.ip] = did not pass
Why is the domain localhost.localdomain being reported ? The returned mail has the correct From field in the email header, so why is it being sent with the incorrect domain name ?
Help here is greatly appreciated.