User Tools

Site Tools



Make sure your mailserver is properly set up and mails not considered as SPAM. Take a look at this checklist:

host file

Mail servers usually depend on the local host file.

If you don't want to risk to find yourself on a spam list, make sure you specify your domain correctly.


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.       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6 eul0001162-vmware2 eul0001162vmc eul0001162-vmware2 eul0001162vmc eul0001162-vmware2 eul0001162vmc

Following the setup above the mail server is going to use put a correct domain name in the header:

Received: from ( [])

You will still be able to send emails with another sender address domain. As example you could still send mails as 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.


  • Edit /etc/mail/
  • Run
    m4 /etc/mail/ > /etc/mail/



Check the mailserver logs

tail /var/log/maillog

Search for messages in the maillog other than "stat=Sent"

egrep -i "(stat=[^Sent])+" /var/log/maillog | less 

Send mails from the console

  • use the “mail” command line utility and set a subject with the -s option
  • enter text to include within the mail (body) and tab Control D if your done
  • define a CC (optional) a tab Enter
$ mail -s "Testmail"
Hello, I'm just sending a testmail...
[Ctrl + D]

Send mails with the php mail function

 php -r "mail('', 'The subject' , 'put your text here', '');"

Send mail over telnet

telnet mailserver 25
helo root
mail from:root

Receive status emails from the server

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

To make the new alias effective type the following command:

On older system (i.e. Red Hat EL 3) with postfix as mailserver, the aliases file can be found under /etc/postfix/aliases.
/srv/ · Last modified: 2012/08/07 10:02 by niwo