->
Some of you may remember that I went on a Mutt kick there a while back and gave up for a few different reasons. I have been using Thunderbird 2.x series since, which has been pretty good, but I still think all mail clients suck. I don’t know exactly what it is about them– maybe I just don’t like email in general.
Anyway, last nite I got to thinking about Mutt again and what I didn’t like about it. One of my main complaints is that it relies on postfix and relays through your local machine. I would prefer if it were able to send outgoing through one of my many domains, my ISP, etc. Granted I still have a few other complaints with Mutt, but this tutorial will take care of the mail relaying anyway.
In this tutorial I’ll outline installing, configuring and using ESMTP to handle your outgoing mail. This will allow you to send your email, via Mutt, through gmail, your ISP, or some other mail relay that you have access to. I’ll outline using gmail here, but you should easily be able to customize it for your own needs.
Install and Configure ESMTP
First we’ll replace postfix with ESMTP for our mail relaying. Use a command such as the one below to install ESMTP, which should auto-remove postfix.
sudo aptitude install esmtp
On the Ubuntu 6.06.1 server that I tested this on it auto-removed postfix at this point. If dependencies or packages have changed since then you might find different results. I have yet to test on current (Ubuntu 7.04).
We can now configure esmtp to use your ISP or, in this case, to use a gmail account to send email through.
Open and edit a new file in your home folder called $HOME/.esmtprc (there is also a global in /etc/esmtprc).
To use gmail for your outgoing mail set your $HOME/.esmtprc to the following settings:
identity username@gmail.com
hostname smtp.gmail.com:587
username "username@gmail.com"
password "password"
starttls required
mda "/usr/bin/procmail -d %T"
You’ll need to set the permissions on this file to private before esmtp will function properly. Use this command to set the permissions:
chmod 0600 .esmtprc
After you’ve done this you need to tell Mutt to use these settings. You can do this by setting a symlink from what Mutt normally looks for in sendmail to the new esmtp, or we can just tell it the path within the mutt configuration file. We’ll do the latter here. Add the following two lines into your .muttrc file:
set sendmail="/usr/bin/esmtp"set envelope_from=yes
or (if you want debug logging done during testing)
set sendmail="/usr/bin/esmtp -v -X /tmp/esmtp.log"
Now one last thing that needs to be done here is put the Gmail Certificate Authority (CA) in the proper place so that the tls will work for encrypted outgoing connection. If you are not using gmail you may not need this step. Run the following commands to put the CA in the proper place for use by ESMTP and the gmail connection.
mkdir ~/.authenticate
chmod 0700 ~/.authenticate
sudo aptitude install ca-certificates (this may already be in place, it was on my Dapper machine)
cp -a /etc/ssl/certs/ ~/.authenticate/ca
chmod -R go-rwx ~/.authenticate/ca
At this point Mutt should be configured to use ESMTP for outgoing mail and will relay through whatever host you specify (that you have access to, of course). You can test this by opening Mutt and trying to send a message. Check the /tmp/esmtp.log for details on troubleshooting or whether or not things worked as planned. Of course you’ll need the logging configured as above to troubleshoot this.
This, I think, solves one of my major concerns with Mutt and makes it a bit more flexible for my needs. I may come back to Mutt for a while… at least until I get tired of it again and come to another client looking for something more. It’s inevitable considering all mail clients suck, right?
(much of these instructions were based on information in the esmtp manual, see there for more details.)
If this site has been useful, please consider participating in the Fundraiser.