Skip to content

Instantly share code, notes, and snippets.

@hrsvrdhn
Last active April 3, 2018 16:46
Show Gist options
  • Save hrsvrdhn/51695ef7db1e94ded2922cc3e367b411 to your computer and use it in GitHub Desktop.
Save hrsvrdhn/51695ef7db1e94ded2922cc3e367b411 to your computer and use it in GitHub Desktop.
message = """
<p> THIS IS MY MESSAGE </p>
"""
# email_addresses = []
# with open("emails.txt") as f:
# for line in f:
# email_addresses = line.strip().split(",")
import sendgrid
sg = sendgrid.SendGridAPIClient(apikey="") # API KEY INSIDE QUOTES
# for email_address in email_addresses:
mail = {
"personalizations": [
{
"to": [
{
"email": "" # Jisko bhejna hai
}
],
"subject": "" # Subject
}
],
"from": {
"name": "Harsh Vardhan Sharma",
"email": "harshavardhana.619@gmail.com"
},
"content": [
{
"type": "text/html",
"value": message
}
]
}
response = sg.client.mail.send.post(request_body=mail)
if response.status_code == 202:
print("chala gaya sahi salamat")
else:
print("nhi gaya")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment