Skip to content

Instantly share code, notes, and snippets.

@amalgjose
Created February 25, 2020 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalgjose/7104313a71c22c4382e6ea491f2421ff to your computer and use it in GitHub Desktop.
Save amalgjose/7104313a71c22c4382e6ea491f2421ff to your computer and use it in GitHub Desktop.
Python program to send email to multiple users using Send Grid
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
message = Mail(
from_email=('amal@gmail.com', 'Amal G Jose'),
to_emails=[('receiver01@mail.com', 'Receiver 02'), ('receiver02@mail.com', 'Receiver 02')],
subject='Sample Email',
html_content='My test email')
sg = SendGridAPIClient('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
response = sg.send(message)
print(response.status_code, response.body, response.headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment