Skip to content

Instantly share code, notes, and snippets.

@marcosan93
Created August 23, 2021 17:11
Show Gist options
  • Select an option

  • Save marcosan93/b5c585bd7407de384cc16733e73a1e4a to your computer and use it in GitHub Desktop.

Select an option

Save marcosan93/b5c585bd7407de384cc16733e73a1e4a to your computer and use it in GitHub Desktop.
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