We will deprecate this version on February 10, 2025. To access all the latest features and upcoming developments, please see our v3 API. For assistance with transitioning, refer to our migration guide.
We recommend using SendGrid Python, our client library, available on GitHub, with full documentation.
The library does not officially support the V2 API, but you can use V2 with an older version of the library. For more information, see Continue Using V2 in Python.
1# using SendGrid's Python Library2# https://github.com/sendgrid/sendgrid-python3import sendgrid45client = sendgrid.SendGridClient("SENDGRID_APIKEY")6message = sendgrid.Mail()78message.add_to("test@sendgrid.com")9message.set_from("you@youremail.com")10message.set_subject("Sending with SendGrid is Fun")11message.set_html("and easy to do anywhere, even with Python")1213client.send(message)