In this article, we will examine installing and using Gitlab on Ubuntu server version 20.04. Gitlab community edition or Gitlab CE can be installed by
Are you looking to install and configure Sendmail on RHEL 9 or CentOS 9 but don’t know where to start? Look no further! In this article, we’ll guide you through the process of setting up Sendmail in just a few easy steps.
Sendmail is a widely used mail transfer agent (MTA) that enables users to send and receive email messages on Unix-based operating systems. In this article, we will guide you through the process of setting up Sendmail in RHEL9 or CentOS9 and provide an example of sending an email to a Gmail address.
Photo by Andrew Lloyd Gordon from Pixabay
Sendmail was created in the early 1980s by Eric Allman, who was then a student at the University of California, Berkeley.
Allman developed Sendmail to help the university’s computer systems communicate with each other more efficiently. The original version of Sendmail, known as Sendmail 4, was released in 1983 and became the first widely used MTA.
Since then, Sendmail has undergone numerous updates and improvements. Sendmail 5 was released in 1985 and introduced support for the Simple Mail Transfer Protocol (SMTP), which is now the standard protocol used for email transmission.
Root access: You’ll need root access to install and configure Sendmail.
A fully qualified domain name (FQDN): Sendmail requires a valid FQDN to function correctly. If you don’t have an FQDN, you can set one up using a domain registrar or DNS hosting service.
Firewall settings: Ensure that the firewall settings on your system allow inbound and outbound traffic on port 25, which is the default port used for SMTP.
Once you’ve met these prerequisites, you can proceed with setting up Sendmail by following the steps below.
Before we begin, it is best practice to update the system. Run the following command:
$ sudo dnf update
The first step is to install Sendmail and associated packages. Open your terminal and run the following command:
$ sudo dnf install sendmail m4 s-nail
This installs the Sendmail MTA (Mail Transfer Agent), the m4 macro processor, and the s-nail command-line mail client in a RHEL 9 or CentOS 9 system.
sudo
command is used to run the following command as the root user, which is necessary to install software packages.dnf
is the default package manager used in RHEL 9 and CentOS 9. install
command is used to install software packages.sendmail
is the MTA that the command installs.m4
is a macro processor that is required for configuring Sendmail.s-nail
is a simple command-line mail client that can be used to test Sendmail’s functionality after it’s been configured.Once Sendmail is installed, you’ll need to configure it. Open the Sendmail configuration file using your preferred text editor. In this example, we’ll use vim:
$ sudo vim /etc/mail/sendmail.mc
Next, locate the line that reads:
dnl define(`SMART_HOST', `smtp.your.provider')dnl
Uncomment it by removing the “dnl” at the beginning of the line, and replace “smtp.your.provider” with your email provider’s SMTP server. For example, if you’re using Gmail, the line should look like this:
define(`SMART_HOST', `smtp.gmail.com')dnl
Save and close the file. Then, generate the Sendmail configuration file using the following command:
$ sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
After configuring Sendmail, restart it using the following command:
$ sudo systemctl restart sendmail
● sendmail.service - Sendmail Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/sendmail.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2023-03-12 23:19:43 EDT; 13min ago
Process: 30283 ExecStartPre=/etc/mail/make (code=exited, status=0/SUCCESS)
Process: 30284 ExecStartPre=/etc/mail/make aliases (code=exited, status=0/SUCCESS)
Process: 30288 ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG (code=exited, status=0/SUCCESS)
Main PID: 30289 (sendmail)
Tasks: 1 (limit: 23134)
Memory: 4.5M
CPU: 1.380s
CGroup: /system.slice/sendmail.service
└─30289 "sendmail: accepting connections"
To test Sendmail, we’ll send a sample email to a Gmail address. Run the following command, replacing “youremail@gmail.com” with your actual Gmail address:
$ echo "Test Email" | sendmail -v youremail@gmail.com
Check your Gmail inbox for the email. If it arrives successfully, congratulations! You’ve successfully configured Sendmail.
Setting up Sendmail in RHEL 9 or CentOS 9 requires a few prerequisites, but with this step-by-step guide, it’s a breeze. Follow the above steps, and you’ll be sending emails in no time. Don’t forget to ensure that your email system is secure and reliable by regularly updating and maintaining it.
Related Posts
In this article, we will examine installing and using Gitlab on Ubuntu server version 20.04. Gitlab community edition or Gitlab CE can be installed by
Unlock the power of relational databases and streamline your data management processes by discovering how to easily install MySQL on CentOS – a must-know skill
Looking to establish a reliable and secure web presence? Learn how to Install Apache web server on CentOS and unlock the potential of your website