Created
August 23, 2021 17:11
-
-
Save marcosan93/b5c585bd7407de384cc16733e73a1e4a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def sendMyEmail(sender, recipient, subject, content): | |
| """ | |
| Takes in email details to send an email to whoever. | |
| """ | |
| # Sendgrid client | |
| email = Mail( | |
| from_email=sender, | |
| to_emails=recipient, | |
| subject=subject, | |
| html_content=content | |
| ) | |
| # Sending the email | |
| response = sg.send(email) | |
| # Returning either a successful message or not | |
| if response.status_code==202: | |
| return "Email has been accepted!" | |
| return "Email wasn't sent" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment