While I was looking for a lightweight solution the check for new mail, I came across the Gmail Inbox Feed. This is an Atom feed of your inbox which can also be filtered by your labels. Obviously you have to be logged into your account to use this feature or provide your credentials for each request. The certificate check is disabled, because the router has no list of valid certificate authorities.
curl -k -s -u "${email}:${password}" "https://mail.google.com/mail/feed/atom/${label}/"
The periodic checking is happening on a TP-Link router running OpenWRT triggered by a cronjob. Although the limited resources of the router, the Atom feed can easily be processed by curl, grep, sed and awk.
If a new message appears, an additional SSID gets enabled. The broadcast gets stopped again by atd after 10 minutes.
The script also takes care if multiple emails arrive during the broadcasting and refreshes the lifetime (pending shutdowns request get queried with atq and removed by atrm).
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.