Make sure your mailserver is properly set up and mails not considered as SPAM. Take a look at this checklist: http://www.linuxmail.info/mail-server-checklist/
Mail servers usually depend on the local host file.
The format must be <IP Adress> <full qualified domain name> <host name> <alias 1> <alias 2> etc.
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 18.104.22.168 eul0001162-vmware2.eu.verio.net eul0001162-vmware2 eul0001162vmc 192.168.63.233 eul0001162-vmware2.eu.verio.net eul0001162-vmware2 eul0001162vmc 192.168.214.131 eul0001162-vmware2.eu.verio.net eul0001162-vmware2 eul0001162vmc
Following the setup above the mail server is going to use put a correct domain name in the header:
Received: from eul0001162-vmware2.eu.verio.net (eul0001162-vmware2.eu.verio.net [22.214.171.124])
You will still be able to send emails with another sender address domain. As example you could still send mails as email@example.com just make sure the IP of the mailserver is allowed in DNS (as MX or over a SPF record).
Take a look at the online documentation.
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
egrep -i "(stat=[^Sent])+" /var/log/maillog | less
$ mail -s "Testmail" firstname.lastname@example.org Hello, I'm just sending a testmail... [Ctrl + D] Cc: [Enter]
php -r "mail('email@example.com', 'The subject' , 'put your text here', '');"
telnet mailserver 25 helo root mail from:root rcpt to:firstname.lastname@example.org data Hello . QUIT
To receive status emails from the server, the easiest is to configure /etc/aliases in order to receive mails for root:
# Person who should get root's mail root: email@example.com
To make the new alias effective type the following command: