This is a simple script I created to help me with simple tasks where I need to send a couple emails as a batch, but nothing professional. Feel free to use. Every improvement feedback is welcome, but remember to be nice.
-
Add the recipient emails to the recipients.json file. Add name and email as you can see in the file sample.
-
Create a simple html template file under the templates folder. You can always use the default template as a starting point. Right now we can only replace email title and recipient name, but it is easy to expand that in the future.
-
Define your credentials on config.py , you will need to add your credentials, be carefull when sharing that. If you want to send emails via GMAIL you should check this tutorial. How To Set Up Your Gmail SMTP Settings (2023 Guide)
-
Define the number of emails you want to send at each hour to avoid being blocked or overcharged by your server.
python send.py "TEMPLATE.HTML" "EMAIL TITLE" "EMAIL SUBJECT"
A json file is going to be saved for each batch of emails you send. You can check if your email was successfully sent or not. In case of failures we add the error string so you can debug.