Mutt with remote IMAP and SMTP servers
Steve Losh has a typically high quality howto on his mutt setup here: http://stevelosh.com/blog/2012/10/the-homely-mutt/.
While I thought it was elegent, I only intend to use mutt where I have reliable/fast internet, and so offlineimap seemed somewhat like overkill.
However getting mutt to play nice to a remote IMAP and SMTP server is not too difficult and seemed well worth the marginal effort. Mutt is still a pain compared to, say, Mail.app but it is also very highly configurable. This is the usual tradeoff in the unix world it seems to be even more so the case with mutt. Anyhow … 1) Install mutt
pkg install mutt
Pleasingly the package (on FreeBSD 10.0) seems to include both the sidebar patch and IMAP support.
Update: unfortunately as of Nov-14 and on my most recent 10.1 install (per the changelog as at http://www.freshports.org/mail/mutt/) the sidebar patch is no longer included. Scroll to bottom for how to change folders.
2) Sort the .muttrc for IMAP access. I used the guide here http://dev.mutt.org/trac/wiki/MuttGuide/UseIMAP.
At least to start off with, you only need something similar to the below for IMAP:
set imap_user="$USERNAME_GOES_HERE" set imap_pass="$PASSWORD_GOES_HERE" set folder="imaps://$HOSTNAME" set spoolfile="imaps://$HOSTNAME/INBOX" # activate TLS if available on the server set ssl_starttls=yes # always use SSL when connecting to a server set ssl_force_tls=yes # Don't wait to enter mailbox manually unset imap_passive # Automatically poll subscribed mailboxes for new mail (new in 1.5.11) set imap_check_subscribed # Reduce polling frequency to a sane level set mail_check=60 # And poll the current mailbox more often (not needed with IDLE in post 1.5.11) set timeout=10 # keep a cache of headers for faster loading (1.5.9+?) set header_cache=~/.hcache # Display download progress every 5K set net_inc=5
3) Install and configure msmtp, which is lighter analogue to sendmail using a smarthost i.e. it takes the message submission, authenticates with the remote smtp server and then hands it off.
There is a good guide here http://freebsd.hypermart.net/msmtp.html
If you get the following
msmtp: server message: 504 5.5.2 <localhost>: Helo command rejected: need fully-qualified hostname msmtp: could not send mail (account default from /home/mike/.msmtprc)
Then you need to follow this tip at the other end (assumes postfix) http://labs.hoffmanlabs.com/node/1856
Worth noting that msmtp has a
domain configuration option whereby you can tell it to identify itself as something other than the default ‘localhost’.
4) You probably then want to tweak the .muttrc for further utility. I used Steve Losh’s guide for that because it is impressively extensive and I like his preferences (e.g. vim style bindings).
Forwarding attachments in a sane mannor
In use, one thing that I couldn’t work out how to do was forward attachments in a sane manner. The way to do this, from http://sandgorgon.wordpress.com/2011/01/20/forwarding-attachments-with-mutt/, is to
vto go into attachment menu
tto tag each attachment that should be forwarded, plus the message itself if desired
- Edit and send as normal
Changing folders without the sidebar
- Select folder and hit enter