v2 API Python Code Example

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.

Using SendGrid's Python Library

# using SendGrid's Python Library
# https://github.com/sendgrid/sendgrid-python
import sendgrid

client = sendgrid.SendGridClient("SENDGRID_APIKEY")
message = sendgrid.Mail()

message.set_subject("Sending with SendGrid is Fun")
message.set_html("and easy to do anywhere, even with Python")

See a mistake? Edit this page