How can I send a file as an attachment via email in bash script, without using mutt and uuencode?
-
4It's kind of weird to tag this mutt when you specifically don't want that....mattdm– mattdm2016-06-02 15:51:49 +00:00Commented Jun 2, 2016 at 15:51
-
sorry, newbie to this kind of forum.user548682– user5486822016-06-02 16:25:02 +00:00Commented Jun 2, 2016 at 16:25
-
On what operating system (if Linux, what distribution)? The available commands for sending mail differ quite a lot on different unix variants.Gilles 'SO- stop being evil'– Gilles 'SO- stop being evil'2016-06-03 21:44:03 +00:00Commented Jun 3, 2016 at 21:44
Add a comment
|
1 Answer
echo "Message body" | mailx -s "Subject" -a "/path/to/attachment" [email protected]
or
cat "/path/to/messagebody.txt" | mailx -s "Subject" -a "/path/to/attachment" [email protected]
-
Thanks for the answer. But I didnt get it work to send as attachment.user548682– user5486822016-06-02 16:30:02 +00:00Commented Jun 2, 2016 at 16:30
-
Could you be a bit more specific than 'it didn't work'?DopeGhoti– DopeGhoti2016-06-02 17:19:00 +00:00Commented Jun 2, 2016 at 17:19
-
mail: invalid option -- a Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ... [-- sendmail-options ...] mail [-iInNv] -f [name] mail [-iInNv] [-u user]user548682– user5486822016-06-02 17:22:05 +00:00Commented Jun 2, 2016 at 17:22
-
-
1@DopeGhoti - things that are not the same
mailx. There are several different versions ofmail/mailx, all with different options and capabilities. On Debian, for example, there are (at least)bsd-mailx,heirloom-mailx, ands-nailpackages which provide different versions ofmailandmailx.cas– cas2016-06-03 02:51:46 +00:00Commented Jun 3, 2016 at 2:51