Send a file as an attachment in linux
Have a file you need sent as an attachment, not an inline message? Use mutt and this example command. the trick is the "--" whichThe meaning of the double-dash "--" is:
-- Used with a Bash builtin, it means the end of options to that particular command.
-- The double-dash is also used in conjunction with set.
echo "This is the body" |mutt -a "/path/to/file.to.attach" -s "subject of message" -- recipient@domain.com
NOTES:
"-" a single dash can be used for:
-- redirection from/to stdin or stdout [dash]
-- Example: cat -
-- Example: tar cf - .
--
(cd /source/directory && tar cf - . ) | (cd /dest/directory && tar xpvf -) |
-- example: grep Linux file1 | diff file2 -