Last active
April 3, 2018 16:46
-
-
Save hrsvrdhn/51695ef7db1e94ded2922cc3e367b411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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