Open jackjindtnt opened 7 years ago
TO_ADDRESS="recipient@domain.com" FROM_ADDRESS="sender" SUBJECT="linux mail send attachment example" BODY_FILE="script.dat" ATTACHMENT_FILE="logfile.txt" CC_LIST="user1@gmail.com;user2@yahoomail.com;user3@earthlink.com;user4@cheetahmail.com"
uuencode ${ATTACHMENT_FILE} | mail -s ${SUBJECT} -c ${CC_LIST} ${TO_ADDRESS} -- -r ${FROM_ADDRESS} < ${BODY_FILE}
https://stackoverflow.com/questions/4658283/shell-script-to-send-email https://stackoverflow.com/questions/5155923/sending-a-mail-from-a-linux-shell-script https://stackoverflow.com/questions/20426077/how-to-send-a-mail-with-a-message-in-unix-script https://stackoverflow.com/questions/2500436/how-does-cat-eof-work-in-bash https://stackoverflow.com/questions/1781989/sending-email-using-unix-shell-scripting https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script?rq=1 https://stackoverflow.com/questions/17359/how-do-i-send-a-file-as-an-email-attachment-using-linux-command-line
!/bin/bash
TO_ADDRESS="recipient@domain.com" FROM_ADDRESS="sender" SUBJECT="linux mail send attachment example" BODY_FILE="script.dat" ATTACHMENT_FILE="logfile.txt" CC_LIST="user1@gmail.com;user2@yahoomail.com;user3@earthlink.com;user4@cheetahmail.com"
uuencode ${ATTACHMENT_FILE} | mail -s ${SUBJECT} -c ${CC_LIST} ${TO_ADDRESS} -- -r ${FROM_ADDRESS} < ${BODY_FILE}
-------------------------------------------------------------------------------
https://stackoverflow.com/questions/4658283/shell-script-to-send-email https://stackoverflow.com/questions/5155923/sending-a-mail-from-a-linux-shell-script https://stackoverflow.com/questions/20426077/how-to-send-a-mail-with-a-message-in-unix-script https://stackoverflow.com/questions/2500436/how-does-cat-eof-work-in-bash https://stackoverflow.com/questions/1781989/sending-email-using-unix-shell-scripting https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script?rq=1 https://stackoverflow.com/questions/17359/how-do-i-send-a-file-as-an-email-attachment-using-linux-command-line