kimberli / wikinews

email daily news from wikipedia's current events portal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wikinews

A quick Python script to send an email with the contents of Wikipedia's daily current events page.

Setup

Create an email address to send from, then use an email sending service that allows sending over SMTP (since Gmail recently (deprecated this support)[https://support.google.com/accounts/answer/6010255?rfn=1651196585577]). The service I use is Sendgrid via SMTP.

First run git update-index --assume-unchanged email_config.json to avoid checking in configuration changes.

Edit the fields in email_config.json to have sender account credentials and a recipient list.

{
    "sender_server": "smtp.sendgrid.net",
    "sender_email": "sender@email.com",
    "sender_user": "apikey",
    "sender_password": "<API key from Sendgrid>",
    "recipients": ["first@recipient.com", "second@recipient.com"]
}

Usage

Run the send_email.py script. You'll probably want to e.g. set up a cron job to run this daily :)

0 5 * * * python3 /home/kim/wikinews/send_email.py > /home/kim/email.log 2>&1

Development

Run mypy send_email.py to run type checking.

About

email daily news from wikipedia's current events portal

License:MIT License


Languages

Language:Python 100.0%