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
What Does Tournament Mean in Duolingo Diamond League?
Duolingo’s Diamond League is the highest league in the app’s competitive ranking system. If you’ve made it here, congratulations! But…