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

su
yum install sendmail-cf

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

su
cd /etc/mail
cp sendmail.mc sendmail.mc.bak
cp sendmail.cf sendmail.cf.bak

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

su
cd /etc/mail
gedit sendmail.mc

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 cloudman.ca at these two lines:

  • MASQUERADE_AS (‘cloudman.ca’) dnl
  • MASQUERADE_DOMAIN (cloudman.ca) dnl

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

su
cd /etc/mail
m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
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" [email protected] < /dev/null

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

sendmail

 

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

sendmail, 4th Edition
List Price: $59.99
Price: N/A
You Save: N/A

Be the first to comment on "Configure Sendmail on Fedora 20/RedHat/CentOS to send emails"

Leave a comment

Your email address will not be published.


*


Get Adobe Flash player Plugin by wpburn.com wordpress themes