wikinews
所属分类:博客
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2023-12-14 13:48:27
上 传 者:
sh-1993
说明: 维基百科时事门户的电子邮件每日新闻
(email daily news from wikipedia s current events portal)
文件列表:
email_config.json
send_email.py
# 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.
```json
{
"sender_server": "smtp.sendgrid.net",
"sender_email": "sender@email.com",
"sender_user": "apikey",
"sender_password": "
",
"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.
近期下载者:
相关文件:
收藏者: