Topic: multi SMTP servers with mutt

Ok. So you have several email accounts and mutt manages them all - but you want to reply to emails with different "From:" tags that have to be sent via different smtp servers... well, here's your answer... (thanx to scottro's excellent work)

For the purposes of this RTFM, I have the following two email accounts:

John Doe
J. Doe

each requires a mailserver suitable for its domain, so let's assume they're as follows, with requiring authentication:

First, install yourself a copy of msmtp - it's in pkgsrc and am betting it's in ports, etc.

msmtp works by being passed a "-f" switch by mutt which says who the email is "from" and uses this information to determine which smtp server to use. As such, let's configure ~/.muttrc to use msmtp as we need:

set sendmail="/path/to/msmtp"
set use_from=yes
set envelope_from=yes

In order to make the change in our email "From" header when in mutt, we include scottro's example. When you press <esc> followed by the corresponding number, command is displayed and this is enabled by pressing <enter> :

macro generic "<esc>1" ":set realname='John Doe'"
macro generic "<esc>2" ":set realname='J. Doe'"

We now create the corresponding ~/.msmtprc file:

# - home account
account example
auth off

# - work account
account work
auth on
user johndoe
password s3cr3t

# Set a default account to use
account default : example

That should all make sense - it's just so easy!

Happy multi-smtp-server emailing

"UBER" means I don't drink the coffee... I chew the beans instead
             -- Copyright BSDnexus