-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathmail.py
23 lines (17 loc) · 840 Bytes
/
mail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sendgrid
import os
from sendgrid.helpers.mail import *
def main_func(email_id):
from_email = Email("[email protected]", name="Rahul Arulkumaran")
to_email = Email(email_id)
subject = "Testing Merkalysis"
content = Content("text/html", "<html><body><p>Test Email from Instalysis to figure out whether the API is functioning proper or not!</p></body></html>")
mail = Mail(from_email, subject, to_email, content)
response = sg.client.mail.send.post(request_body=mail.get())
return response
if(__name__=="__main__"):
sg = sendgrid.SendGridAPIClient(apikey="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")
for email_id in email_list:
response = main_func(email_id)
print(response.status_code)