0

Is it possible to open mutt via a commandline flag directly in the "new mail" dialog with a file already attached? I want to make myself a ranger-shortcut to open mutt and attach a file to a mail. Is that possible? Do you have any ideas how I could make that?

allinonemovie
  • 652
  • 1
  • 6
  • 20
  • What have you tried already? Is `mutt toto@example.com -a /tmp/file.txt` enough for your use case? – Juancho Aug 03 '20 at 13:58
  • Actually yes, thanks a lot! I can't believe it was so easy. I was using `echo "some-message" | mutt someone@example.org` already, but I totally forgot to test it without piping a message to stdin. Sometimes you are simply to blind to see the solution, thanks a lot (you should probably change your comment to an answer, so that I can accept it) – allinonemovie Aug 04 '20 at 13:19

1 Answers1

3

You can add one or more attachment files directly when calling mutt. For example:

mutt toto@example.com -a /tmp/file1.txt -a /tmp/file2.png -s "subject line"

Unless a message body is fed into stdin (like cat message | mutt ...), the editor will open for typing in the message body.

Juancho
  • 7,207
  • 27
  • 31