0% found this document useful (0 votes)
73 views2 pages

Emailalerts Send Email Alerts Using SSMTP

This document provides instructions for setting up ssmtp to send email alerts from the command line on Ubuntu. It describes prerequisites like having an Ubuntu system and Gmail account, then explains how to install ssmtp, configure it with your Gmail credentials, test the setup by sending an email, and potential errors to check like incorrect credentials or being blocked by Google.

Uploaded by

ahem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views2 pages

Emailalerts Send Email Alerts Using SSMTP

This document provides instructions for setting up ssmtp to send email alerts from the command line on Ubuntu. It describes prerequisites like having an Ubuntu system and Gmail account, then explains how to install ssmtp, configure it with your Gmail credentials, test the setup by sending an email, and potential errors to check like incorrect credentials or being blocked by Google.

Uploaded by

ahem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

5/19/2020 EmailAlerts - Community Help Wiki

Partners
Support
Community
Ubuntu.com

Page History
Login to edit

Search

EmailAlerts

Send email alerts using ssmtp Contents

Here’s how to setup sending emails through command line. A 1. Send email alerts using ssmtp
common application could be to send an alert message through 2. Prerequisites
user created script. 3. Setup
4. configure ssmtp
5. Check setup
Prerequisites 6. Errors

Ubuntu Server/Desktop
Gmail account

Setup
Update Ubuntu Repository

sudo apt-get update

Install the ssmtp package

sudo apt-get install ssmtp

configure ssmtp
Edit the configuration file. The lines without the # are the ones we are interested in.
sudo nano /etc/ssmtp/ssmtp.conf

Adjust and add as necessary to match the following parameters

Change "MyEmailAddress" and "MyPassword" to your own.

# Config file for sSMTP sendmail


#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
#root=postmaster
[email protected]

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
#mailhub=mail
mailhub=smtp.gmail.com:587

[email protected]
AuthPass=MyPassword
UseTLS=YES
UseSTARTTLS=YES

# Where will the mail seem to come from?


#rewriteDomain=

https://help.ubuntu.com/community/EmailAlerts 1/2
5/19/2020 EmailAlerts - Community Help Wiki
rewriteDomain=gmail.com

# The full hostname


#hostname=MyMediaServer.home
hostname=MyMediaServer.home

# Are users allowed to set their own From: address?


# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

Create aliases for local usernames (optional)

edit the /etc/ssmtp/revaliases file


sudo nano /etc/ssmtp/revaliases

And add into it the desired translation which in our Gmail examples case will be
root:[email protected]:smtp.gmail.com:587
mainuser:[email protected]:smtp.gmail.com:587

From now on, the machine will Email when requested through command line or script.

Check setup
Lets test that our ssmtp setup was correct by sending an Email
echo "Test message from Linux server using ssmtp" | sudo ssmtp -vvv [email protected]

The “-vvv” turns on verbosity output.

Errors
Unfortunately a few thing can go wrong.

Check username and password again

Check google is not blocking your new device

EmailAlerts (last edited 2017-05-11 22:03:33 by evilnick @ cpc104960-bath7-2-0-cust247.18-


1.cable.virginm.net[82.40.190.248]:evilnick)

https://help.ubuntu.com/community/EmailAlerts 2/2

You might also like