Space Panda

Sending Mail

This is the sixth part in the series on Reading Mail in the Terminal.

For sending emails you could set up (neo)mutt to do the sending on its own. However, since we have multiple identities we would have to switch between various sending configurations depending on the From address.

Luckily there’s msmtp to do that for us: you use it just like a normal smtp client. But when it comes to sending it will look at the From and determine what mail server to send the mail through.

And here’s how you configure msmtp for the two accounts:

# ~/.msmtprc

auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log

port 587
user baldrick
passwordeval "~/bin/ private-mail"

port 587
passwordeval "~/bin/ work-mail"

account default :

As you can see, the script from earlier plays again an important role.

Now we only have to tell (neo)mutt to send mail through msmtp:

# ~/.config/neomutt/neomuttrc

set send_charset  = "utf-8:iso-8859-15"
set sendmail      = "/usr/bin/msmtp"
set sendmail_wait = 0

And that’s about it.

Identity management is covered in the next post.

Tagged as mail, msmtp, neomutt