Linux/bash: using mutt to send a file as an email attachment (via: Stack Overflow)
Posted by jpluimers on 2014/08/21
Just in case I need this again:
None of the mutt ones worked for me. It was thinking the email address was part of the attachemnt. Had to do:
echo “This is the message body” | mutt -a “/path/to/file.to.attach” -s “subject of message” — recipient@domain.com
Thanks Alexander Bird for noticing the double-dash, rynop for the modified answer and Chris N for the original answer.
From mutt(1): Mutt Mail User Agent – Linux man page:
mutt – The Mutt Mail User Agent
Synopsis
…
mutt [-nx] [-e cmd] [-F file] [-H file] [-i file] [-s subj] [-b addr] [-c addr] [-a file […] –] addr […]
mutt [-nx] [-e cmd] [-F file] [-s subj] [-b addr] [-c addr] [-a file […] –] addr […] < message
…
Options
…
-a file […]
Attach a file to your message using MIME. When attaching single or multiple files, separating filenames and recipient addresses with “–” is mandatory, e.g. mutt -a image.jpg — addr1 or mutt -a img.jpg *.png — addr1 addr2. The -a option must be placed at the end of command line options.
Well, it seems the -a does not need to be at the end, but the — must be there.
–jeroen
via: bash – How do I send a file as an email attachment using Linux command line? – Stack Overflow.






Leave a comment