| layout | page | ||
|---|---|---|---|
| weight | 0 | ||
| title | Python | ||
| navigation |
|
{% github sendgrid/sendgrid-python#example Python %} We recommend using SendGrid Python, our client library, available on Github, with full documentation. {% endgithub %}
{% anchor h2 %} Using SendGrid's Python Library {% endanchor %} {% codeblock lang:python %}
using SendGrid's Python Library - https://github.com/sendgrid/sendgrid-python
import sendgrid
sg = sendgrid.SendGridClient(api_user, api_key) message = sendgrid.Mail()
message.add_to("[email protected]") message.set_from("[email protected]") message.set_subject("Sending with SendGrid is Fun") message.set_html("and easy to do anywhere, even with Python")
sg.send(message) {% endcodeblock %}