LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   cmd line send attachment? (https://www.linuxquestions.org/questions/linux-general-1/cmd-line-send-attachment-334255/)

jedimastermopar 06-16-2005 12:26 PM

cmd line send attachment?
 
I am writing a script to tar a group of files andthen email it to a an account I have setup. The problem is when I use mail like this
mail -s "Backup tar" backup@mydomain.com < /var/backups/backup.tar
it puts the tar into the boy of he message. How do I get it to attach in a cmd line properly. No I don't want to start a debate on if the body is an attachment :) I just want to it to show up as an attachment. Thanks a bunch for reading.
:p

nixcraft 06-16-2005 12:40 PM

Very easy
Use mutt command insted of mail
mutt -s "Backup tar" -a /var/backups/backup.tar backup@mydomain.com < /tmp/message

See script that mails file to gmail account http://www.cyberciti.biz/nixcraft/pr...ipts/mybackup/

jedimastermopar 06-16-2005 12:51 PM

Thanks. Just figured out. :) also figure out you can do tack on a /dev/null for an empty body to the message.

mutt -s "Backup tar" -a /var/backups/backup.tar backup@mydomain.com < /dev/null

Thanks again though.


All times are GMT -5. The time now is 11:02 PM.