Setup Email on Centos

To setup email on Centos 6 run these commands

yum -y install sendmail mailutils
chkconfig --levels 235 sendmail on
service sendmail restart

To send a test email

echo "test message" | mail -s "test subject" [email protected]

Hosts File

Modify your hosts file and add $HOSTNAME.local to prevent issues (in example below we are using hostname monitor)

<your ip address>  monitor monitor.local
service sendmail restart

Why Do I Need a FQDN in Hosts File?

i see users post this over and over – “sendmail hangs” or “sendmail takes forever to load”

the problem is that sendmail is looking for a FQDN, and it is probably finding your hostname before localhost and localhost.localdomain

your host file entry should have your simple hostname after the others:

/etc/hosts

127.0.0.1 localhost.localdomain localhost myhostname <— order matters!!!

if done this way, sendmail sees a FQDN for your loopback interface and will breeze right through.

Leave a Reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>