How To Install sendmail on Debian 11

In this tutorial we learn how to install sendmail on Debian 11. sendmail is powerful, efficient, and scalable Mail Transport Agent (metapackage)

Introduction

In this tutorial we learn how to install sendmail on Debian 11.

What is sendmail

sendmail is:

Sendmail is an alternative Mail Transport Agent (MTA) for Debian. It is suitable for handling sophisticated mail configurations, although this means that its configuration can also be complex.

Fortunately, simple things can be done easily, and complex things are possible, even if not easily understood ;) Sendmail is the ONLY MTA with a Turing complete language to control ALL aspects of delivery!

Sendmail provides Security and SPAM/UCE/UBE protection via several means.

Sendmail includes no Mail User Agents (MUA), you’ll have to pick from the plethora of available MUAs (mutt, vm, etc.)

This package supports REGEX, DB, NIS, NIS+, LDAP, DNS maps, and has enabled TCPWrappers, IPv6, LockFile, SMTP AUTH(SASL), STARTTLS(SSL).

This package is to make installation/upgrading easier (Do NOT delete it)

There are three methods to install sendmail on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install sendmail Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install sendmail using apt-get by running the following command:

sudo apt-get -y install sendmail

Install sendmail Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install sendmail using apt by running the following command:

sudo apt -y install sendmail

Install sendmail Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install sendmail using aptitude by running the following command:

sudo aptitude -y install sendmail

How To Uninstall sendmail on Debian 11

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

sudo apt-get remove sendmail

Uninstall sendmail And Its Dependencies

To uninstall sendmail and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove sendmail

Remove sendmail Configurations and Data

To remove sendmail configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge sendmail

Remove sendmail configuration, data, and all of its dependencies

We can use the following command to remove sendmail configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge sendmail

Dependencies

sendmail have the following dependencies:

References

Summary

In this tutorial we learn how to install sendmail package on Debian 11 using different package management tools: apt, apt-get and aptitude.