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

raf mutt at raf.org
Sat Nov 27 23:05:32 UTC 2021


On Sat, Nov 27, 2021 at 12:36:54PM +0100, Mihai Lazarescu <mtlagm at gmail.com> wrote:

> 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

When I have had to do things based on the sender address,
I had to "set editor" to a script that would perform the
necessary modifications to the email before and after
invoking the real editor on the file.

cheers,
raf



More information about the Mutt-users mailing list