Send SMTP email from Command Line Linux / SSMTP / GMAIL

Dear All,

It is not possible that on every Single System there is mail server available.

There is no mail server configured on your System and You want to send e-mail using SMTP Authentication then you can send mail by ssmtp utility.

You can use the Same Method for RHEL / CentOS / Fedora / Ubuntu.

So In this Article, I will show you that How can can send e-mail using Gmail Authentication using SMTP.


In this Article, We will use utility called SSMTP.

SSMTP RPM / DEB / Package Must be installed to Use this utility.

To Perform this HowTo :-

Step 1. You have to be root to Install and Perform this Howto.

Step 2. Open the ssmtp.conf in /etc/ssmtp/ssmtp.conf and Add the Following lines as per your requirement.

[root@linux-support-tejas-barot-ahmedabad ~]# vim /etc/ssmtp/ssmtp.conf 

Add the Following Configurations to /etc/ssmtp/ssmtp.conf and SAVE and EXIT

Step 3. Now Let’s say Now You want to send a Particular message. Like :-

Subject will be “Check the Server Health” and Body will be your “Cannot Access Server“.

So For the same Create a File called /root/message.txt and Add Following content to file :-

[root@linux-support-tejas-barot-ahmedabad ~]# vim /root/message.txt
Subject: Check the Server Health
Cannot Access Server

Step 4. Now to Send an e-mail Execute Following command :-

Syntax is ssmtp -vvvv < <message-file>

[root@linux-support-tejas-barot-ahmedabad ~]# ssmtp -vvvv < message.txt

That’s IT

Hope this will helps you all, If you face any issue regarding the same or its not working for your some how then please raise your questions / issues then comment down below.

If you like this then Please Click Google +1 Button and Show Your Support. Your Support will encourage me to write more articles.

All Linux User’s Blog Mobile Applications :-

Please Keep in Touch with Social Networking :- 

Facebook Page :-

Enjoy SMTP 🙂 Enjoy SSMTP 🙂 Enjoy Open Source 🙂 

One thought on “Send SMTP email from Command Line Linux / SSMTP / GMAIL”

  1. Thanks for useful information.
    I’d like to learn that is it possible to define variables(like system variables or command arguments) inside ?

Leave a Reply

Your email address will not be published. Required fields are marked *