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
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
And here’s how you configure msmtp for the two accounts:
# ~/.msmtprc defaults auth on tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile ~/.msmtp.log # example.org account example.org host mail.example.org port 587 user baldrick passwordeval "~/bin/getpassword.sh private-mail" # bigcompany.com account bigcompany.org host mail.bigcompany.com port 587 from firstname.lastname@example.org user email@example.com passwordeval "~/bin/getpassword.sh work-mail" account default : example.org
As you can see, the
getpassword.sh 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.