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 email@example.com J. Doe firstname.lastname@example.org
each requires a mailserver suitable for its domain, so let's assume they're as follows, with work.com 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 email@example.com realname='John Doe'" macro generic "<esc>2" ":set firstname.lastname@example.org realname='J. Doe'"
We now create the corresponding ~/.msmtprc file:
# example.com - home account account example host mail.example.com from email@example.com auth off # work.com - work account account work host smtp.work.com from firstname.lastname@example.org 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
-- Copyright BSDnexus