0

Here's what I want to do:

I've composed a mail in mutt. Now I want to add an attachement by executing a script which prints a path, which is the file which should be attached.

I want to be able to do this from within mutt.

Use-case: Add a iCal/vCard as attachement which is selected by script (which then exports it from my calendar/addressbook, saves it in a file and reports this file back to mutt, which adds it as attachement.

musicmatze
  • 4,124
  • 7
  • 33
  • 48
  • sorry, but stackOverflow isn't a free coding service. You're expected to show some code, and ask questions about how to fix it. Good luck. – shellter Jan 13 '15 at 20:45

2 Answers2

1

The question is old, but there is now an answer, thanks to Neomutt-File-Picker.

The "executed script" is in fact ranger or vifm, used as "file explorers": after navigating to the desired file(s), ranger/vifm outputs their filenames in a temporary file, which is then read by mutt to attach the corresponding files.

rfs
  • 81
  • 5
-2

mutt -s "Subject Line Here" -a $(path/to/your/script.sh) email@domain.com < message.txt

where

script.sh is responsible creating the file you are attaching and outputting the absolute path to this file, and only the path, nothing else, for instance:

#!/bin/sh
tar -cvf /tmp/mytarfile.tar /home/user1/*.txt
gzip /tmp/mytarfile.tar
echo /tmp/mytarfile.tar.gz
exit

this script will create /tmp/mytarfile.tar.gz and print the file name and path as its only output, before exiting.

MelBurslan
  • 2,383
  • 4
  • 18
  • 26
  • But I cannot do this _from within mutt_. – musicmatze Jan 14 '15 at 14:56
  • how are you planning to run a script, from inside mutt ? And if you know how to do this, you can easily insert the command I gave you as answer, into a script and run it while you are within mutt. If you do not have any shell access to create a script, your question is moot from the get-go. I don't know what else to tell you. – MelBurslan Jan 16 '15 at 23:13