How would I use the mail command, without the mutt utility, to send a tar.gz file. The Mail utility works on the command line, however it asks me who to cc and the text on the terminal page. It also requires me to ctr D to send a mail. How would I avoid this in a script?
This question has sort of been answered already...
Based on the answers I've seen above though it doesn't deal with the CC part though. Basically, you just need to add a "-c email@example.com" option.
cat message.txt | mail -s "Backup" -a file.tar.gz firstname.lastname@example.org -c email@example.com
Stick it in a script file and it that will be the basis for further automation.
You cat some sort of message file to the mail utility.
cat mailbody.txt | mail -A yourfile.tgz -s "your mail subj line" firstname.lastname@example.org
Note that contrary to previous answer at least in Ubuntu mail utility you specify attachments by -A. -a is used to add extra headers.