Emailalerts Send Email Alerts Using SSMTP
Emailalerts Send Email Alerts Using SSMTP
Partners
Support
Community
Ubuntu.com
Page History
Login to edit
Search
EmailAlerts
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
configure ssmtp
Edit the configuration file. The lines without the # are the ones we are interested in.
sudo nano /etc/ssmtp/ssmtp.conf
# 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
https://help.ubuntu.com/community/EmailAlerts 1/2
5/19/2020 EmailAlerts - Community Help Wiki
rewriteDomain=gmail.com
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]
Errors
Unfortunately a few thing can go wrong.
https://help.ubuntu.com/community/EmailAlerts 2/2