I maintain a few blogs on various topics and I needed a system to send a weekly/monthly newsletter with a curated list of posts.
For that purpose I made a Flask app to publish, manage and generate a newsletter.
It uses the Flask Microframwork as a base. I have given it access to my email id (newsletter@abhishekbalam.xyz) to connect with SMTP provided by Zoho.
All the email creds are stored as environment vars in Heroku.
It uses a Redis database to store the users and their emails in a Hash datatype.
The app uses various steps to authenticate the emails, using:
The data for the latest newsletter is stored at a different location, for easy updation, in Json format.
The app, on publish trigger, accesses the json and converts the data to be rendered into the template.
The newsletter email template is rendered using the feature rick Jinja 2 templating language.
At the same time, the user data is drawn out too, and added to individual emails, with details like name and email.
Then they all are sent sent using the Flask_mail
module.
I use the urls, to get basic info , also to publish the latest newsletter.
The App has the following features:
I learnt alot about: