In this installment, we'll finish up our look at email.

Now that we have mutt talking to the outside world, it would be handy if we could also send messages from the command line as we did in Part 8 using the mail command. Fortunately, mutt supports the same technique.

Using mutt On The Command Line

We can send the output of a command to a remote email recipient via our POP3 configuration using a command such as this:

me@linuxbox:~$ ls -l | mutt-p -s "test message"

Here we used the alias "mutt-p" described in the previous installment. Please note that if such an alias were used in a shell script, it would most likely fail because the .bashrc file where the alias is defined is not sourced by the copy of the shell executing the script. In such a case, we would need to spell the command out fully:

mutt -F ~/.muttrc-pop3 -s "test message"

Another Mail Client

While Debian installs mutt by default, it's not the only full-featured text-based email client available. Another popular choice is Alpine, the successor to the popular PINE email client from the University of Washington. Alpine is similar to mutt in most respects though I think it has an easier user interface:

In addition to the usual email functions, Alpine also sports its own address book and Alpine's configuration is adjustable from within the user interface so that editing the configuration files is not strictly necessary, but its configuration is as complicated as mutt's.

Alpine configuration, top-level

Alpine configuration, down deep

Summing Up

Text-based email clients have a long and storied history in the Unix world and remain the tools of choice for serious email users. As you dig deeper into the documentation of mutt and Alpine, you will find that nothing compares to the configurability of either of these programs.

Further Reading

More support resources for mutt:
For Alpine:

Posted By William Shotts to Tips, News And Rants at 2/05/2010 12:47:00 PM