Introduction

Mutt is a small but very powerful text-based mail client for Unix operating systems. It is great for testing mail server setups and sending email messages via the command line.

Installation

Mutt has mail-transport-agent as a dependency which means if you don't have a Mail Transport Agent installed on your system and you install Mutt an MTA will also be installed, Postfix being the default. If you want to install a different MTA than Postfix, Exim4 for example, you will need to install the package before installing Mutt.

If you don't need a full fledged and feature full MTA, but want to send messages using Mutt a good substitute is the ssmtp package in the Universe repository. SSMTP can be configured to send mail to a proper MTA or mail hub.

Mutt can be installed from the Main repository see InstallingSoftware for details.

Sending Messages Via CLI

Once you have Mutt and a MTA installed sending messages via command line or bash script is simple.

For example:

echo "Test" | mutt -s Hello user@example.com

The above command will send a message to user@example.com with the subject of "Hello" (the -s) and the word "Test" in the message body.

SSMTP configuration

This section will provide instructions on using the ssmtp package to deliver mail to another MTA.

The SSMTP configuration file is /etc/ssmtp/ssmtp.conf edit the following options:

mailhub=mta.example.com
hostname=your_local_machine

That should do it, just make sure that you are allowed to relay messages through the host configured in the mailhub option.

SSMTP with SMTP AUTH

Here are some options you can configure if the mailhub you are using requires authentication in order to relay messages:

AuthUser=username
AuthPass=password
UseTLS=YES
UseSTARTTLS=YES

You may not need the UseTLS and UseSTARTTLS options. Use these options to configure TLS encryption with the MTA (usually a good idea).

Note: this guide has been tested on Ubuntu 6.06 (Dapper), Ubuntu 7.06 (Feisty), and Ubuntu 7.10 (Gutsy).


CategoryEmail

mutt (last edited 2008-10-10 20:29:21 by littlergirl)