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 my.account@gmail.com -t recipient1@domain.tld \
-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 my.account@gmail.com -t recipient1@domain.tld \
-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 my.account@gmail.com -t recipient1@domain.tld recipient2@otherdomain.tld \
-cc user2@isp.net tom@isp.net jess@isp.net \
-bcc user2@isp.net tom@isp.net jess@isp.net \
-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