Koozali.org: home of the SME Server
Obsolete Releases => SME Server 7.x => Topic started by: basmistry on August 23, 2008, 12:54:58 AM
-
How do I attach file using command line mail
I've used Suse Linux in before and it has a "-a" option to attach a file
eg.
echo Test Completed at `date` | mail -s "Test email" -a /home/test.log me@mydomain.com
(date is set at top of the script)
-
How do I attach file using command line mail
I've used Suse Linux in before and it has a "-a" option to attach a file
eg.
echo Test Completed at `date` | mail -s "Test email" -a /home/test.log me@mydomain.com
(date is set at top of the script)
mail is not installed, instead mutt is, there is a bash one-liner on how to send mail with that from the command line here: http://www.cyberciti.biz/tips/sending-mail-with-attachment.html
-
Mail is installed
the does not support attachments ie. have a -a option
I can send an emal
echo Test Email from SME | mail me@mydomain.com -s "This is a test from SME"
-
I've sorted it myself...
My file is a Text file so ...
echo Test Completed at `date` | mail -s "Test email" -a /home/test.log me@mydomain.com < /home/mytextfile.txt
-
I've sorted it myself...
My file is a Text file so ...
echo Test Completed at `date` | mail -s "Test email" -a /home/test.log me@mydomain.com < /home/mytextfile.txt
Mail only has one "standard input". You can't do pipe and also redirect from a file. If you want both text in your mail, you need to do:
( echo Test Completed at $(date); cat /home/mytextfile.txt ) | mail -s "Test email" me@mydomain.com
$(...) has various advantages over backticks and is recommended syntax these days.