How To Install mailx on CentOS 8

mailx is Enhanced implementation of the mailx command

Introduction

In this tutorial we learn how to install mailx on CentOS 8.

What is mailx

Mailx is an enhanced mail command, which provides the functionality of the POSIX mailx command, as well as SysV mail and Berkeley Mail (from which it is derived). Additionally to the POSIX features, mailx can work with Maildir/ e-mail storage format (as well as mailboxes), supports IMAP, POP3 and SMTP protocols (including over SSL) to operate with remote hosts, handles mime types and different charsets. There are a lot of other useful features, see mailx(1). And as its ancient analogues, mailx can be used as a mail script language, both for sending and receiving mail. Besides the “mailx” command, this package provides “mail” and “Mail” (which should be compatible with its predecessors from the mailx-8.x source), as well as “nail” (the initial name of this project).

We can use yum or dnf to install mailx on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install mailx.

Install mailx on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install mailx using dnf by running the following command:

sudo dnf -y install mailx

Install mailx on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install mailx using yum by running the following command:

sudo yum -y install mailx

How To Uninstall mailx on CentOS 8

To uninstall only the mailx package we can use the following command:

sudo dnf remove mailx

mailx Package Contents on CentOS 8

/bin/mail
/bin/mailx
/etc/mail.rc
/usr/bin/Mail
/usr/bin/nail
/usr/lib/.build-id
/usr/lib/.build-id/e0
/usr/lib/.build-id/e0/16cad374c96ed5dbda7f751ab0cc153815c49f
/usr/share/doc/mailx
/usr/share/doc/mailx/AUTHORS
/usr/share/doc/mailx/COPYING
/usr/share/doc/mailx/README
/usr/share/man/man1/Mail.1.gz
/usr/share/man/man1/mail.1.gz
/usr/share/man/man1/mailx.1.gz
/usr/share/man/man1/nail.1.gz

References

Summary

In this tutorial we learn how to install mailx on CentOS 8 using yum and dnf.