Created
August 19, 2021 18:10
-
-
Save souravs17031999/c1d1bae39689464b5596a3e9281aa552 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mail_body = generate_mail_content("mail.html) | |
message = Mail( | |
from_email=sender_email, | |
to_emails=receiver_email, | |
subject=subject, | |
html_content=mail_body) | |
try: | |
sendgridAPIClientKey = os.getenv('SENDGRID_API_KEY') | |
sg = SendGridAPIClient(sendgridAPIClientKey) | |
response = sg.send(message) | |
print(response.status_code) | |
except Exception as e: | |
print(e) | |
print(e.body) | |
print(e.message) | |
print("failure !") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment