If you haven't read part 1 and want to receive mail, see here!

For configuring mutt for multiple accounts, see part 3!

Fortunately, configuring msmtp to send mail is substantially easier than getting mail. Here's an example ~/.msmtprc:

logfile ~/path/to/msmtp.log

account home
host mail.xyzzy.org
port 587
protocol smtp
from plugh@xyzzy.org
auth on
user plugh
passwordeval gpg2 -q --for-your-eyes-only --no-tty --batch -d ~/.mail-home.gpg
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt 

account work
host localhost
port 1025
protocol smtp
from thud@yoyodyne.com
auth login
user thud
passwordeval gpg2 -q --for-your-eyes-only --no-tty --batch -d ~/.mail-work.gpg

account default : home

where, similar to before, mail.xyzzy.org, plugh@xyzzy.org, plugh, thud@yoyodyne.com, and thud are the locations of your home SMTP server, your home email address, your home login, your work email, and your work login respectively. Usually passwordeval can use the same command as for mbsync, assuming your IMAP and SMTP passwords are the same. Also, you don't have to use the same account names as you did with mbsync, but it's probably easier if you do.

The bottom line sets the account default, meaning that if msmtp is run with no other qualifications, mail will be set using that account (here, home).

To test your configuration, you can try

$ echo "cheese" | msmtp -a work bigboote@lectroids.com

obviously using a different email address that you can check. If it goes through and works for both accounts, you're good!

Additionally, for log maintenance, I added the following to my crontab, similarly to before with mbsync:

@weekly  cd $HOME/mail/logs && echo "$(tail -1000 msmtp.log)" > msmtp.log

For configuring mutt for multiple accounts, see part 3!