Jaie Wilson

  • Archive
  • RSS

Sending emails from command line on Ubuntu

This is a simple guide for setting up a server with a dyndns domain to be able to use a google account to send emails from the command line or report emails from cronjobs.

I tried several different solutions that I found via google search and found this one to be the easiest.

You can either use an existing gmail account or do as I did and create a new account specifically for this task as I didn’t want to put my personal gmail account details on the server.

First install ssmtp:

sudo apt-get install ssmtp

Edit the ssmtp config file:

sudo vim /etc/ssmtp/ssmtp.conf

Update the contents of the ssmtp.conf file with the following details: 

root=username@gmail.com

mailhub=smtp.gmail.com:465

rewriteDomain=gmail.com

AuthUser=username

AuthPass=password

FromLineOverride=YES

UseTLS=YES

Now test the congifuration:

ssmtp <recipient_email_address>

To: <recipient_email_address>

From: <from_email_address>

Subject: Testing Contents go here.

To send the email press: Ctrl + D

    • #server
    • #email
  • 10 months ago
  • Permalink
  • Share
    Tweet

About

Random things to do with frontend and backend coding. Love javascript.

Me, Elsewhere

  • @jaiew on Twitter
  • jaiew on bitbucket
  • jaiew on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr