How to configure a real domain name for sender address

Solution 1:

I think I have just solved it. I have the following in /etc/hosts:

127.0.0.1 www.mydomain.com test.mydomain.com
127.0.0.1 cdn.mycdn.com
127.0.0.1 localhost.localdomain localhost myserver.com

What I need is to place myserver.com in front of the line with localhost.localdomain so that sendmail will think that it is using a real domain to send out the email.

Solution 2:

You have to configure, in your scripts, the headers of your email to have From: [email protected].