Quick tutorial on how to send emails using Python and smtplib.
Sendgrid
Sendgrid offers 100 free outbound emails per day, sign up with them via sendgrid.com/free, create a API Key and save your credentials in a safe place.
You first need to verify your account by sending a mail using their API, but it’s step by step so won’t take more than 2 minutes to complete.
Python Code
Once the verification is completed, our Python Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
When I ran the code, I received the mail, and when you inspect the headers you can see that the mail came via sendgrid:
1
|
|
Resources:
Great post on SSL / TLS: - https://stackabuse.com/how-to-send-emails-with-gmail-using-python/
Enjoy :D