Linux security

Configure Sendmail on Fedora 20/RedHat/CentOS to send emails

You have installed your new Linux machine and you want be able to send out email from the machine to the world. You may want to send out email once some scripts finished, your backup or as I am using also send mail when user logs in to the system or summary of failed logins, weekly email with patches for the system. I am running Linux Fedora 20 machine and I would like to be able to send system emails. I have chosen to use traditional way to send email out with use sendmailutility. Sendmail is a monster and really have a lot of features, ways to configure and can be intimidating at first. Lets try to configure the sendmail quickly and simple for sending out emails to the world.

1. Install the sendmail on your Fedora system

yum install sendmail-cf

2. Once installed on your system go to /etc/mail directory and make backup of and files

cd /etc/mail

3. Lets now use my domain as teh domain from which email will be send from teh machine and configure the file

cd /etc/mail

Make sure you remove dnl from the beginning of  these lines:

  • LOCAL_DOMAIN (‘localhost.localdomain’) dnl
  • FEATURE (masquerade_envelope) dnl
  • FEATURE (masquerade_entire_domain) dnl

Enter your domain name you want to use – in my case at these two lines:

  • MASQUERADE_AS (‘’) dnl

4. Once you have finished with the customization you need to run this command and restart sendmail on the system

cd /etc/mail
m4 /etc/mail/ > /etc/
service sendmail restart

5. All is good now. We should test out to send email to the world with Sendmail and confirm that all is working fine

sendmail -s "TEST EMAIL" < /dev/null

If you have configured all right way, you should by now receive the test email in from your machine in your mailbox 🙂



This is it ! Your sendmail utility works and emails are sent out 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.