using msmtp with mutt

Since a few days ago i only used mutt directly on my server where the fully-loaded and configured postfix was running. The setup always worked and still works fine, but i wanted to use mutt also on a different machine and still be able to send mail via smtp through my postfix on the server.

As I don’t want to use postfix for this simple „mail-forwarding“ job, i googled a bit through the internet and found msmtp.

Installation and configuration is quite simple. msmtp is available via package-management on most linux distributions and it only needs on single configuration-file to get it running.

Simple paste the following content (adapted to your needs of course) to .msmtprc in your home folder:

account default
host mail.yourserver.com
auth on
user johndoe
password verysecret

What’s now left to do is to tell mutt to use msmtp instead of /usr/sbin/sendmail.
This is done via the following line in your .muttrc:

# use msmtp
set sendmail="/usr/bin/msmtp"

That’s it.