Advertisement
Md_Zahid_Hassan

Json Error

Oct 10th, 2019
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import sendgrid
  2. from sendgrid.helpers.mail import Content, Email, Mail
  3.  
  4. sg = sendgrid.SendGridAPIClient("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")
  5. from_email = Email("my@gmail.com")
  6. to_email = Email("your@gmail.com")
  7. subject = "A test email from Sendgrid"
  8. content = Content(
  9. "text/plain", "Here's a test email sent through Python")
  10.  
  11. mail = Mail(from_email, subject, to_email, content)
  12. response = sg.client.mail.send.post(request_body=mail.get())
  13.  
  14. # The statements below can be included for debugging purposes
  15. print(response.status_code)
  16. print(response.body)
  17. print(response.headers)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement