Linux security

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

You have installed your new [easyazon_link asin=”0782127371″ locale=”US” new_window=”default” nofollow=”default” tag=”wn0d5-20″ add_to_cart=”default” cloaking=”default” localization=”default” popups=”default”] Linux [/easyazon_link] 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 [easyazon_link asin=”0133477436″ locale=”US” new_window=”default” nofollow=”default” tag=”wn0d5-20″ add_to_cart=”default” cloaking=”default” localization=”default” popups=”default”] Fedora [/easyazon_link] 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 [easyazon_link asin=”0596510292″ locale=”US” new_window=”default” nofollow=”default” tag=”wn0d5-20″ add_to_cart=”default” cloaking=”default” localization=”default” popups=”default”] sendmail [/easyazon_link]utility. 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 [easyazon_link asin=”B00HJUBRPQ” locale=”US” new_window=”default” nofollow=”default” tag=”wn0d5-20″ add_to_cart=”default” cloaking=”default” localization=”default” popups=”default”] Fedora [/easyazon_link] 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 [easyazon_link asin=”1409213900″ locale=”US” new_window=”default” nofollow=”default” tag=”wn0d5-20″ add_to_cart=”default” cloaking=”default” localization=”default” popups=”default”] Sendmail [/easyazon_link] and confirm that all is working fine

sendmail -s "TEST EMAIL" john@doe.com < /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 🙂

[easyazon_block add_to_cart=”default” align=”left” asin=”0596510292″ cloaking=”default” layout=”left” localization=”default” locale=”US” nofollow=”default” new_window=”default” tag=”wn0d5-20″]sendmail[/easyazon_block]

Leave a Reply