Make my Sweex router send me emails under script control.
(this can send alerts when something goes wrong)
I discovered ssmtp which can send emails from my old Sweex router under openwrt
install it -
ipkg install ssmtp_2.61-2_mipsel.ipk
ssmtp requires two files to be configured -
etc/smtp/ssmtp.conf
# # /etc/ssmtp.conf -- a config file for sSMTP sendmail. # root=myname@mysite.co.uk <- my usual email address mailhub=smtp.mysite.co.uk <- the smtp server of my email provider rewriteDomain=mysite.co.uk hostname=mysite.co.uk FromLineOverride=YES AuthUser=mail_login_name AuthPass=mail_login_password |
etc/smtp/etc/revaliases
# sSMTP aliases root:mail_login_name:smtp.mysite.co.uk |
Create an email message and save as a text file
email_message.txt
From: <myname@mysite.co.uk> Message here after a blank line |
cd to the folder with the message then type this to send the message -
cat email_message.txt | ssmtp -v myname@mysite.co.uk
The | character says "pipe the output generated by cat to my email address"
I now intend to write a script that checks the level of the food in my chicken feed hopper
and sends me an email alert when it gets low (but only once per day!)