Close

2) - Checking for new emails

A project log for 802.11 Jungle

My WIFI enabled Geocache

sehaassehaas 01/19/2018 at 19:310 Comments

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