Skip to content

Instantly share code, notes, and snippets.

@pziecina
Last active December 11, 2015 17:48
Show Gist options
  • Select an option

  • Save pziecina/4636800 to your computer and use it in GitHub Desktop.

Select an option

Save pziecina/4636800 to your computer and use it in GitHub Desktop.
How to send email from cmd line
#source: http://www.debianadmin.com/how-to-sendemail-from-the-command-line-using-a-gmail-account-and-others.html
#--help is very helpful
#simple - message from file
sendEmail -f [email protected] -t [email protected] \
-u "this is the test tile" -m "this is a test message" \
-a /mnt/storage/document.sxw "/root/My Documents/Work Schedule.kwd"
-s smtp.gmail.com:587 \
-xu my.account -xp mypasswd
#simple - message from stream
grep ERROR service.log | sendEmail -f [email protected] -t [email protected] \
-u "this is the test tile" -m "this is a test message" \
-s smtp.gmail.com:587 \
-xu my.account -xp mypasswd
#more complex
sendEmail -f [email protected] -t [email protected] [email protected] \
-cc [email protected] [email protected] [email protected] \
-bcc [email protected] [email protected] [email protected] \
-u "this is the test tile" -m "this is a test message" \
-s smtp.gmail.com:587 \
-xu my.account -xp mypasswd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment