LEDE/OpenWRT — Sending Email
There are a number of packages for LEDE/OpenWRT that allow you to send emails. We are going to be looking at SSMTP.
With email sending configured, you could set up automatic emails such as system alerts, or to goof around with sending emails via CLI.
Here we will run you through the steps needed to get the packages installed and basic usage.
SSH to your LEDE/OpenWRT device
If you are using Windows then start PuTTY and click Session on the left side, select SSH from the options, and then enter in the IP Address of your LEDE/OpenWRT box into the Host Name field.
Once you’ve done this just click on Open to start up the SSH connection.
If you are connecting via terminal, then just SSH to your LEDE/OpenWRT device using the following command, where 192.168.1.1 is your LEDE/OpenWRT device’s IP address.
Installing SSMTP is quick and easy. Just run the following commands:
opkg install ssmtp
Next we need to edit the SSMTP config file with your mail server details, run the following command:
You should see something similar to the following:
Fill in with your mail server details. For more information, search for your email provider’s SMTP settings.
There are a few ways to send emails using SSMTP. The simplest is to create a text file and run a command to send it.
First create a text file by running the following:
Now populate your text file using the following format:
This is the body of the email
Once you have written your email you can send it using the following command:
mail email@example.com < email.txt
For more information on the other methods, and what else you can do with SSMTP, take a look at this wiki page.