Skip to content

Commit

Permalink
Handle new API in the helper example (#818)
Browse files Browse the repository at this point in the history
* Fix to handle new API
* Make it return the raw Mail object rather than a JSON representation
  • Loading branch information
enugentdt authored and thinkingserious committed Jun 28, 2019
1 parent f549dc0 commit 610e933
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ content = Content("text/plain", "some text here")
The `Content` class takes mainly two parameters: MIME type and the actual content of the email, it then returns the JSON-ready representation of this content.

```
mail = Mail(from_email, subject, to_email, content)
mail = Mail(from_email, to_email, subject, content)
```
After adding the above we create a mail object using `Mail` class, it takes the following parameters: email address to send from, subject line of emails, email address to send to, content of the message.
For more information on parameters and usage, see [here](https://github.com/sendgrid/sendgrid-python/blob/master/sendgrid/helpers/mail/mail.py)
Expand Down Expand Up @@ -58,7 +58,7 @@ After you have configured every component and added your own functions, you can
```
sg = SendGridAPIClient()
data = build_kitchen_sink()
response = sg.client.mail.send.post(request_body=data)
response = sg.send(data)
```
Make sure you have [environment variable](https://github.com/sendgrid/sendgrid-python/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key) set up!
Full example [here](https://github.com/sendgrid/sendgrid-python/blob/0b683169b08d3a7c204107cd333be33053297e74/examples/helpers/mail_example.py#L203).
Expand Down
2 changes: 1 addition & 1 deletion examples/helpers/mail_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def build_kitchen_sink():
UtmCampaign("utm_campaign"))
message.tracking_settings = tracking_settings

return message.get()
return message


def send_hello_email():
Expand Down

0 comments on commit 610e933

Please sign in to comment.