Created
August 6, 2016 03:03
-
-
Save joastbg/0748d255d31530d98c0ec1798e34a4c1 to your computer and use it in GitHub Desktop.
Sendgrid in Python
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
import sendgrid | |
import os | |
from sendgrid.helpers.mail import * | |
sg = sendgrid.SendGridAPIClient(apikey="...") | |
from_email = Email("[email protected]") | |
to_email = Email("[email protected]") | |
subject = "Please activate your ABC account" | |
content = Content("text/html", "<h1>Welcome to ABC</h1>Please click this <a href=\"http://www.abc.com/activate/32132112121\">link</a> to activate your account!") | |
mail = Mail(from_email, subject, to_email, content) | |
response = sg.client.mail.send.post(request_body=mail.get()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment