Linux Command
In a previous tutorial, we covered SSMTP, which allows you to send email using the Linux command line using an SMTP server. Using the send email command-line utility, this tutorial makes the operation even simpler. SendEmail is a lightweight command-line SMTP email client that allows you to send emails over an SMTP server. We also covered how to install the send email kit as well as a few explanations of how to send email using a remote SMTP server like Gmail in this article.
Install the SendEmail Package
The SendEmail SMTP client is available in the Ubuntu default repositories; use the commands below to install it.
sudo apt-get update sudo apt-get install sendemail
Sending Email Through SMTP
Example 1: In this example, the email body text is passed as an argument to the command (-o message-file=/tmp/mailbody.txt).
sendemail -l email.log \
-f "sender@domain.com" \
-u "Email Subject 1" \
-t "receiver@domain.com" \
-s "smtp.gmail.com:587" \
-o tls=yes \
-xu "youremail@gmail.com" \
-xp "Email Password" \
-o message-file="/tmp/mailbody.txt" Example 2: In this example, the email body text is piped in from the output of another command. You may also include a cc and bcc email address.
cat mailbody.txt | sendemail -l email.log \
-f "sender@domain.com" \
-u "Email Subject 2" \
-t "receiver@domain.com" \
-cc "receiver2@domain.com" \
-bcc "receiver3@domain.com" \
-s "smtp.gmail.com:587" \
-o tls=yes \
-xu "youremail@gmail.com" \
-xp "Email Password" Saad Shafqat
Related posts
New Articles
Top 7 PR and brand monitoring tools that catch real signals on Reddit and niche forums (Mention, Meltwater, Brandwatch plus setup for Reddit monitoring)
Reddit and niche forums are where real conversations happen. Not polished. Not filtered. Just real talk from people with strong…