Sendmail is an MTA (Mail Transfer Agent) server that is used to transfer email from one host to another. The SMTP (Simple Mail Transfer Protocol) protocol is used by Sendmail. The majority of device administrators favor Sendmail as an MTA to other MTAs.
Sendmail was the default mail server in RHEL 5 and earlier versions, but later versions of RHEL-based systems adopted postfix as the default mail server. The majority of users are comfortable with Sendmail and want to continue using it with version 6. This article will guide users through the process as to how you can install and configure Sendmail on CentOS/RHEL 7/RHEL 6.
1. Install Sendmail
If you do not already have Sendmail installed, use the yum package manager to install it along with the other required packages.
2. Configuring Sendmail Server
Before we begin configuring Sendmail server, we need to be aware of the different Sendmail configuration files located in the /etc/mail directory.
- access — Allow or deny other systems from using Sendmail to send outbound emails.
- domaintable — For Sendmail, this is used to map domain names.
- local-host-names — The host’s aliases are defined here.
- mailertable — The instructions that override routing for specific domains.
- virtusertable — Allows several virtual domains to be hosted on a single machine by specifying a domain-specific type of aliasing.
- In
/etc/mail/sendmail.mc
, comment out the line below to allow receiving email from anywhere. Simply type dnl at the beginning of a line in sendmail.mc to comment it.
- Add this line above the ‘MAILER’ option in sendmail.mc as well.
- 2.3 Fill in the full hostname of your computer in this format.
- 2.3 Fill in the full hostname of your computer in this format.
3. Recomompile the Sendmail Configuration
The Sendmail configuration files are compiled using the m4 macro processor. As M4 is stream-based, it does not understand lines.
Restart the Sendmail service
4. Configure e-mail routing based on a domain
- Support@mydomain.com receives all emails addressed to the @example.com domain.
- All emails sent to support@mydomain.com will be sent to jack, the local user.
- All emails sent to @mydomain.com will be forwarded to the domain @otherdomain.com, along with usernames.
- All emails sent to @otherdomain.com will be ignored by my mail server, with a note acknowledging the sender.
Now Restart the Sendmail service with the following command
Thank you for taking the time to read this article. I hope you found this article useful in installing and configuring Sendmail on CentOS and Red Hat systems.
Saad Shafqat
Related posts
New Articles
Fix BlueBubbles Socket Connection Error: Easy Troubleshooting
BlueBubbles enables Android users to use iMessage, creating a bridge between Apple’s messaging system and non-Apple devices. However, users may…