How To Install msmtp-mta on Ubuntu 18.04

In this tutorial we learn how to install msmtp-mta on Ubuntu 18.04. msmtp-mta is light SMTP client with support for server profiles - the regular MTA

Introduction

In this tutorial we learn how to install msmtp-mta on Ubuntu 18.04.

What is msmtp-mta

msmtp-mta is:

msmtp is an SMTP client that can be used to send mails from Mutt and probably other MUAs (mail user agents). It forwards mails to an SMTP server (for example at a free mail provider), which takes care of the final delivery. Using profiles, it can be easily configured to use different SMTP servers with different configurations, which makes it ideal for mobile clients.

This package is compiled with GSASL and TLS/SSL support.

This package provides the regular MTA program.

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

Install msmtp-mta Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install msmtp-mta

Install msmtp-mta Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install msmtp-mta

Install msmtp-mta 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 Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install msmtp-mta

How To Uninstall msmtp-mta on Ubuntu 18.04

To uninstall only the msmtp-mta package we can use the following command:

sudo apt-get remove msmtp-mta

Uninstall msmtp-mta And Its Dependencies

To uninstall msmtp-mta and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove msmtp-mta

Remove msmtp-mta Configurations and Data

To remove msmtp-mta configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge msmtp-mta

Remove msmtp-mta configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge msmtp-mta

References

Summary

In this tutorial we learn how to install msmtp-mta package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.