Ubuntu: send email from command line using gmail account and server

#install sendemail tool: $> sudo apt-get install sendemail #send a short text email: $> sendEmail -f fromUser@gmail.com \ -t toUser@gmail.com \ -u "This is the subject" \ -m "This is a short body" \ -s smtp.gmail.com:587 \ -o tls=yes -xu fromUser@gmail.com -xp fromUserPassword # sending html content file: # (be sure your file begins with <html> tag): $> cat document.html | sendEmail -f fromUser@gmail.com \ -t toUser@gmail.com \ -u "This is the subject" \ -m "This is a short body" \ -s smtp.gmail.com:587 \ -o tls=yes -xu fromUser@gmail.com -xp fromUserPassword
This command let you send email message from linux command line using a gmail account and gmail smtp server. Here I describe the install process Ubuntu's way (apt-get).

This is very useful for sending email messages using cron automation (be careful with number of messages to be sent. Gmail has limits for each case. Read about it at " https://support.google.com/a/answer/166852?hl=en".

Hope it helps.

2 Responses

sendEmail[4894]: ERROR => No TLS support! SendEmail can't load required libraries. (try installing Net::SSLeay and IO::Socket::SSL)

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.