Skip to content

Instantly share code, notes, and snippets.

@FutoRicky
Last active February 11, 2017 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FutoRicky/34c81de2dab7628adbf133c55af2f64d to your computer and use it in GitHub Desktop.
Save FutoRicky/34c81de2dab7628adbf133c55af2f64d to your computer and use it in GitHub Desktop.
API usage example using sendgrid api
import sendgrid
from sendgrid.helpers.mail import *
sg = sendgrid.SendGridAPIClient(apikey="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")
from_email = Email("test@example.com")
subject = "Hello World from the SendGrid Python Library!"
to_email = Email("bcollazo2010@gmail.com")
content = Content("text/plain", "Hello, Email!")
mail = Mail(from_email, subject, to_email, content)
response = sg.client.mail.send.post(request_body=mail.get())
print(response.status_code)
print(response.body)
print(response.headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment