-
-
Save govindsharma7/f0afa2165a3998d5c47aadc232cf5152 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# import necessary packages | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
# For each contact, send the email: | |
for name, email in zip(names, emails): | |
msg = MIMEMultipart() # create a message | |
# add in the actual person name to the message template | |
message = message_template.substitute(PERSON_NAME=name.title()) | |
# setup the parameters of the message | |
msg['From']=MY_ADDRESS | |
msg['To']=email | |
msg['Subject']="This is TEST" | |
# add in the message body | |
msg.attach(MIMEText(message, 'plain')) | |
# send the message via the server set up earlier. | |
s.send_message(msg) | |
del msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment