Open Laboratory for Technocrats

Grab the developer role, learn concepts & prepare with senior software engineers to get solutions for problems in a software job. Coding and Programming Solutions crafted for you.

Ubuntu - Send Email From Terminal


Today I was doing some stuff and suddenly my system stopped working, I went on to check the RAM it was heavy due to this cleaning process I went to some cool websites and found some new stuff today and that stuff was that we can send Email from Ubuntu's Terminal.

Here are the steps that I followed to send the Email from terminal about my processes that are running into my ubuntu system.

Step 1 - Download and install ssmpt with command    apt-get update && apt-get install ssmtp 
Step 2 - Configure Smart Host by making changes to file with command     gedit /etc/ssmtp/ssmtp.conf    
Step 3 - Now configure your username and password Example goes with  GMAIL as:

 AuthUser=YOUR_GMAIL_ID@gmail.com 
 AuthPass=Your-Gmail-Password              
 FromLineOverride=YES                            
 mailhub=smtp.gmail.com:587                   
 UseSTARTTLS=YES                                

Step 4 - Save and close the file.

After that I had a thought to get the my systems process information on my email id.
For that I run this command into my terminal and it was working fine.

  top -b -n1 | mail -s 'Ubuntu System Information' you@example.com  

And it worked absolutely fine in my system, Hurray I got the mail, Even we can have this on our server so that we can track the things from CRON JOBS to get the interval status on our emails.

Thanks to cyberciti for quick learning 
Enjoy Learning :)

Top #3 Articles

Most Read