Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit be291b0

Browse files
Merge pull request #39 from shutteritch/sendgrid-email-settings
Update sendgrid_emailer.py
2 parents ff1aad1 + e74533c commit be291b0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎days/065-068-heroku-deployment/code/sendgrid_emailer.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import sendgrid
2-
from sendgrid.helpers.mail import Email, Content, Mail
2+
from sendgrid.helpers.mail import Mail
33

4-
sg = sendgrid.SendGridAPIClient(apikey='<apikey>')
4+
sg = sendgrid.SendGridAPIClient(api_key="MY_API_KEY")
55

6-
from_email = Email("test@example.com")
6+
from_email = "test@example.com"
77
subject = "Winter is coming"
8-
to_email = Email("<youremail>@<domain>")
9-
content = Content("text/plain", "So... put on a jumper!")
8+
to_email = "<youremail>@<domain>"
9+
content = "So... put on a jumper!"
1010

11-
mail = Mail(from_email, subject, to_email, content)
11+
mail = Mail(from_email, to_email, subject, content)
1212

13-
response = sg.client.mail.send.post(request_body=mail.get())
13+
response = sg.send(mail)
1414

1515
print(response.status_code)
1616
print(response.body)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /