conservationtechlab/scrubdash

SMS Alert Feature

Closed this issue · 1 comments

After an email alert is sent by the asyncio server, send an SMS alert as well.

The phone number and phone provider will be specified in the config_file.
Example: https://www.reddit.com/r/Python/comments/8gb88e/free_alternatives_to_twilio_for_sending_text/

The reddit example linked in the original comment does not work. I created a small example using the reddit code verbatim and sdzwa.scrubdash@gmail.com says it sends the SMS text, but my phone never receives it.

I found this related issue and linked a commenter who sources a working solution. https://gist.github.com/alexle/1294495/39d13f2d4a004a4620c8630d1412738022a4058f#gistcomment-3690612.

The working solution source code is here: https://github.com/acamso/demos/blob/master/_email/send_txt_msg.py. It uses aiosmtplib, which utilizes asyncio and runs the send_txt method as an asyncio coroutine. This implementation fits perfectly with already existing asyncio code, as the coroutine can be run in the main event loop.