I want to determine the local path of the currently viewed mail within mutt and transfer it to a bash script, before or after saving the mail to a local project folder.
I am using
mutt together with
msmtp in order to decouple my mail infrastructure from the necessity of a permanent internet connection. In doing so, I find my mails within the mailfile structure where each
<ACCOUNT> may live in its own local folder structure:
Mail/ |-- <PROJECT>/ | |-- cur/ | | |-- 1584016380.RPi-18:2, | | |-- 1595241604.RPi-18:2, | | |-- 1603636018.RPi-18:2, | | `-- 1612159655.RPi-18:2, | |-- new/ | `-- tmp/ |-- <ACCOUNT>/ | |-- DRAFTS/ | | |-- cur/ | | |-- new/ | | `-- tmp/ | |-- INBOX/ ...
When I browse my mail (using the index or pager view in mutt), I can select, tag, delete, ... open the respective mail element which is read by mutt from the sketched folder structure.
Now, I want to save the current message using mutt's
save-message function. But beforehand (or after the save), I want to automatically extract the message's attachment and possibly do some other stuff using the mail contents.
I already wrote a bash script which reads in the path of a mail file, e.g.
~/Mail/<PROJECT>/cur/1584016380.RPi-18:2 as its argument, and then stores the mail's attachments in a predefined location using the
I have looked within the available mutt variables (
from, ...) in order to find anything that would tell me where my currently viewed mail file is actually located. But I could not find anything. So, I don't know which path to pass to my bash script for it to find the mail locally.
Is there anything usable, here?