Send SMTP email from Command Line Linux / SSMTP / GMAIL
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
firstname.lastname@example.org mailhub=smtp.gmail.com:587 AuthUseremail@example.com AuthPass=P@ssw0rd UseSTARTTLS=yes
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 firstname.lastname@example.org < <message-file>
[root@linux-support-tejas-barot-ahmedabad ~]# ssmtp -vvvv email@example.com < message.txt
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 at http://linuxforums.tejasbarot.com
If you like this then Please Click Google +1 Button and Show Your Support. Your Support will encourage me to write more articles.
Ask for Linux Commercial Support :- http://www.tejasbarot.com/linux-commercial-support/
All Linux User’s Blog Mobile Applications :- http://www.tejasbarot.com/download-mobile-apps/
Please Keep in Touch with Social Networking :-
Facebook :- https://www.facebook.com/tejasbarot.official
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog
Twitter :- https://www.twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot
Enjoy SMTP Enjoy SSMTP Enjoy Open Source :)