@@ -6,24 +6,24 @@ Please see [here](https://github.com/sendgrid/python-http-client/blob/HEAD/pytho
6
6
There are also email specific exceptions located [ here] ( ../sendgrid/helpers/mail/exceptions.py )
7
7
8
8
``` python
9
- import os
10
- from sendgrid import SendGridAPIClient
11
- from sendgrid.helpers.mail import (From, To, Subject, PlainTextContent, HtmlContent, Mail)
12
- from python_http_client import exceptions
9
+ import os
10
+ from sendgrid import SendGridAPIClient
11
+ from sendgrid.helpers.mail import (From, To, Subject, PlainTextContent, HtmlContent, Mail)
12
+ from python_http_client import exceptions
13
13
14
- sendgrid_client = SendGridAPIClient(os.environ.get(' SENDGRID_API_KEY' ))
15
- from_email
= From(
" [email protected] " )
16
- to_email
= To(
" [email protected] " )
17
- subject = Subject(" Sending with Twilio SendGrid is Fun" )
18
- plain_text_content = PlainTextContent(" and easy to do anywhere, even with Python" )
19
- html_content = HtmlContent(" <strong>and easy to do anywhere, even with Python</strong>" )
20
- message = Mail(from_email, to_email, subject, plain_text_content, html_content)
21
- try :
22
- response = sendgrid_client.send(message)
23
- print (response.status_code)
24
- print (response.body)
25
- print (response.headers)
26
- except exceptions.BadRequestsError as e:
27
- print (e.body)
28
- exit ()
14
+ sendgrid_client = SendGridAPIClient(os.environ.get(' SENDGRID_API_KEY' ))
15
+ from_email
= From(
" [email protected] " )
16
+ to_email
= To(
" [email protected] " )
17
+ subject = Subject(" Sending with Twilio SendGrid is Fun" )
18
+ plain_text_content = PlainTextContent(" and easy to do anywhere, even with Python" )
19
+ html_content = HtmlContent(" <strong>and easy to do anywhere, even with Python</strong>" )
20
+ message = Mail(from_email, to_email, subject, plain_text_content, html_content)
21
+ try :
22
+ response = sendgrid_client.send(message)
23
+ print (response.status_code)
24
+ print (response.body)
25
+ print (response.headers)
26
+ except exceptions.BadRequestsError as e:
27
+ print (e.body)
28
+ exit ()
29
29
```
0 commit comments