How To Install mailagent on Debian 9

In this tutorial we learn how to install mailagent on Debian 9. mailagent is automatic mail-processing tool and filter

Introduction

In this tutorial we learn how to install mailagent on Debian 9.

What is mailagent

mailagent is:

Mailagent is a mail delivery agent, and can be programmed to respond to mail in ways more sophisticated than a mail filtering program like procmail. It is easy to configure, and very easy to extend using Perl. Not only can the base functionality be extended, new commands and processing methods can be added in a modular fashion.

Obeying lex-like rulesets, mailagent can file mails to specific folders (plain Unix-style folders and also MMDF and MH ones), forward messages to third parties, pipe them to commands or post them to newsgroups. The filtering commands that are executed on the messages can be extended, and may rewrite the message headers or body as desired. It can also create and process commands based on key words contained in the body of the mail message.

Mailagent can be used as a vacation program, and can answer mail automatically and with more flexibility than the command of that name. A template can be provided for the body of the response, and the frequency of vacation mails can also be specified. Simple macro substitutions allow parts of the mail header to be recycled into the vacation messages, for a more personalized reply.

Mailagent can also be used to set up a generic mail server, without the hassle of the lower-level concerns like error recovery, logging or command parsing.

Please note that on Debian systems, mailagent requires a catch-all rule saving all mail into the user’s home directory. Unlike other Mail Delivery Agents such as procmail, mailagent is too extensible to be safely made setgid mail, and so cannot lock /var/spool/mail mailboxes.

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

Install mailagent Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install mailagent

Install mailagent Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install mailagent

Install mailagent 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 mailagent using aptitude by running the following command:

sudo aptitude -y install mailagent

How To Uninstall mailagent on Debian 9

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

sudo apt-get remove mailagent

Uninstall mailagent And Its Dependencies

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

sudo apt-get -y autoremove mailagent

Remove mailagent Configurations and Data

To remove mailagent configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge mailagent

Remove mailagent configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge mailagent

Dependencies

mailagent have the following dependencies:

References

Summary

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