[neomutt-users] save message from virtual folder conditional upon source account

Bayle Shanks bshanks.prog at gmail.com
Sat Mar 6 20:13:48 CET 2021

How do I create a macro which sets $folder differently depending on
attributes of the current message?


I have multiple email accounts (for example, a personal email and a work
email) and I have created a virtual folder that shows me a mixture of
emails from the different accounts via a notmuch search.

I would like to have a keyboard shortcut that copies the current message to
another folder, but I would like the location of the folder that it is
copied to to be different depending on which email account the message is
from. This is because I need to keep any saved work emails in a separate
location from all of my other emails.

"which email account the message is from" could be detected via (1) notmuch
tags, or (2) by the folder location of the current message, or (3) by the
To: address in the message.

To accomplish this, I would like to create a macro which (a) redefines the
$folder variable, with conditional branching based on (1), (2), or (3) in
the previous paragraph, and then (b) uses the new $folder variable to
determine the path to which to copy the message.

Therefore my question is, how do I create a macro which sets $folder
differently conditioned upon (1), (2), or (3)?

If this is not possible, then I suppose a workaround would be to apply a
special notmuch tag, and then to call a custom shell script. But it would
be preferable to do everything within neomutt.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.neomutt.org/pipermail/neomutt-users-neomutt.org/attachments/20210306/43d7058e/attachment.html>

More information about the neomutt-users mailing list