SSMTP is a program to deliver an email from a local computer to a configured mailhost (mailhub). It is not a mail server (like feature-rich mail server) But it is using sendmail and does not receive mail, expand aliases or manage a queue. One of its primary uses is for forwarding automated email (like system alerts) off your machine and to an external email address.
With SSMTP on Openwrt you can use command or text email’s draft to send email from OpenWrt
Minimum free space requirements = (1.99 MB)
Installation and Configuration
Step 1: Install SSMTP
- Open OpenWrt’s LuCI Web’s Interface
- Select Tabs System – Software
- Click Update List
- In download and install packages type “ssmtp” then click ok
Step 2: Configure SSMTP
- cd /etc/ssmtp
- vi ssmtp.conf
Append following modified sSMTP configuration (below, it configured for Gmail provider):
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
# The place where the mail goes. The actual machine name is required
# The example will fit if you are in domain.com and your mailhub is so named.
# Where will the mail seem to come from?
# The full hostname
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
# Use SSL/TLS to send secure messages to server.
# Use SSL/TLS certificate to authenticate against smtp host.
# Use this RSA certificate.
# Get enhanced (*really* enhanced) debugging information in the logs
To test if SSMTP is working properly:
Using email draft
Create test email.txt on /tmp folder
Edit test email.txt using the proper formatting of SSMTP
Subject: This is a test mail
Body of email..
Send email to destination.address using test mail.txt email’s draft
ssmtp firstname.lastname@example.org < email.txt
If SSMTP doesn’t work properly or can’t send email, you can try uncomment debug from ssmtp.conf then retry send email. you’ll get debugging information when sending email:
If you receive an unauthorized or “cannot open smtp.example.com:587” while sending email, it is probably blocked by the email server due to the security authentication issue. Try to allow or disable security feature at your email provider (e.g. SMTP or POP3 configuration) or at Gmail you have to toggle “Allow less secure apps” to off.