Since most of our routers are working reliably, sometimes for years without interruption, we tend to forget about them.
We might not be aware that it needs some software-updates or has a problem with hardware or software configuration .
Therefore we want our router to tell us, whenever something is going on that we should be aware of.
A dedicated SMTP user for the router on your mail server.
We assume you already created the account email@example.com on your mail server. This account has the ability to login on the Submission server and send out mails. He does not need any access to a mailbox (IMAP etc.).
ssmtp - A secure, effective and simple way of getting mail off a system to your mail hub.
To install this:
router$ opkg install ssmtp
The configuration file is located at
1 # 2 # /etc/ssmtp.conf -- a config file for sSMTP sendmail. 3 # 4 5 # The person who gets all mail for userids < 1000 6 # Make this empty to disable rewriting. 7 firstname.lastname@example.org 8 9 # The place where the mail goes. The actual machine name is required 10 # no MX records are consulted. Commonly mailhosts are named mail.domain.com 11 # The example will fit if you are in domain.com and your mailhub is so named. 12 mailhub=mail.example.net:587 13 14 # Where will the mail seem to come from? 15 rewriteDomain=router.example.net 16 17 # The full hostname 18 hostname=router.example.net 19 20 # Set this to never rewrite the "From:" line (unless not given) and to 21 # use that address in the "from line" of the envelope. 22 FromLineOverride=YES 23 24 # Use SSL/TLS to send secure messages to server. 25 UseTLS=YES 26 UseSTARTTLS=Yes 27 28 AuthUseremail@example.com 29 AuthPass=******** 30 31 # Get enhanced (*really* enhanced) debugging information in the logs 32 # If you want to have debugging of the config file parsing, move this option 33 # to the top of the config file and uncomment 34 #Debug=YES
Protect the configuration, since it contains account details:
router$ chown root:mail /etc/ssmtp/ssmtp.conf router$ chmod 640 /etc/ssmtp/ssmtp.conf
To send a test mail from the router to you:
router$ ssmtp -v -F 'OpenWRT Router' -f firstname.lastname@example.org "Testing Router Mail Setup" email@example.com