It's a simple Docker container that uses Scrapy library to grab and parse a website, generating parsable JSON file.
After that we bind the JSON with a Mako template, resulting in a dynamic mail content.
Finally, we send it according to the MAIL_TO informed environment variable.
- Docker 18+
Build
docker build -t docker-scrapy-mailer:latest .
Run
docker run -e MAIL_FROM="from@mail" \
-e MAIL_FROM_PASSWORD="***" \
-e MAIL_TO="to1@mail,to2@mail,to3@mail" \
-e MAIL_SUBJECT="Mail Subject" \
-e MAIL_TEXT="Mail Text Body" \
-e MAIL_SMTP_HOST="smtp.mail" \
-e MAIL_SMTP_PORT="587" \
-e CRON_SCHEDULE="*/1 * * * *" \
-ti docker-scrapy-mailer
To make your CRON_SCHEDULE exception easily use the serive CronTab Generator
Like