python
sendgrid
5 years, 4 months ago
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
access_key = "SG.LyourkeyK8qw._ibase" # replace with your accee_key
message = Mail(
from_email='kishorekumarnetala@gmail.com',
to_emails='kishorekumarnetala@gmail.com',
subject='Test Subject',
html_content='<strong>This is a test mail from sendgrid</strong>')
try:
sg = SendGridAPIClient(access_key)
response = sg.send(message)
print('status',response.status_code)
print('body ',response.body)
print('header',response.headers)
except Exception as e:
print(e.message,"error")
0 Comments
Please Login to Comment Here