Last active
February 11, 2017 21:03
-
-
Save FutoRicky/34c81de2dab7628adbf133c55af2f64d to your computer and use it in GitHub Desktop.
API usage example using sendgrid api
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
import sendgrid | |
from sendgrid.helpers.mail import * | |
sg = sendgrid.SendGridAPIClient(apikey="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") | |
from_email = Email("[email protected]") | |
subject = "Hello World from the SendGrid Python Library!" | |
to_email = Email("[email protected]") | |
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