[Mutt] help on complicated per-folder or per-sender sending email hooks

Mihai Lazarescu mtlagm at gmail.com
Sat Nov 27 11:36:54 UTC 2021


On Friday, November 26, 2021 at 23:41:46 -0600, maitra at email.com wrote:

> Basically, if the email is postponed and called from the draft, it uses my work account (because that is set up to be the default). Is it possible to set things up so that mutt will look at the sending address (@email dot com or the work address, say) and decide to use the appropriate smtp?

send2-hook seems the closest, but it's only triggered after edits:

http://www.mutt.org/doc/manual/#send2-hook

«send2-hook is matched every time a message is changed, either 
by editing it, or by using the compose menu to change its 
recipients or subject. send2-hook is executed after send-hook, 
and can, e.g., be used to set parameters such as the $sendmail 
variable depending on the message's sender address.»

For other cases you may want to define macros to manually change 
the roles, e.g.:

macro index,pager,compose <key sequence> ":set from = ...<ENTER>:set smtp_url = ...<ENTER>:set smtp_pass = ...<ENTER>:set smtp_url<ENTER>"

The last :set smtp_url just displays the current SMTP URL so 
you can double check that you called the right macro. :-)

Best,
Mihai


More information about the Mutt-users mailing list