How to send email in SENDGRID using Python

||
Posted 1 year, 6 months ago
||
Views 128
||
1 min read
0 reactions

Step 1:

pip install sendgrid

Step 2:

import sendgrid
import os
from sendgrid.helpers.mail import *
sg = sendgrid.SendGridAPIClient(apikey=[Your Sendgrid Key])
from_email = Email("")
to_email = Email("")
subject = "Sending with SendGrid is Fun"
content = Content("text/plain", "and easy to do anywhere, even with Python")
mail = Mail(from_email, subject, to_email, content)
response = sg.client.mail.send.post(request_body=mail.get())
print(response.status_code)
print(response.body)
print(response.headers)


0 reactions

Discussion


Actively looking for JOBS
Joined on April 15, 2020


Latest Videos


Wanna Post Ad?
Reach a large group of audience by posting an ad about your business here. For more details
Drop us a Message