Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open("emails.csv",'r') as csvfile:
- reader=csv.reader(csvfile)
- for line in reader:
- recipient_name = line[0].split()[0]
- text = """"<b>Greetings</b> """+recipient_name+"""!\n This is a test message of Michael's Email program for the X-mas gift exchange.>"""
- send_email = line[1]
- print(text)
- msg = MIMEMultipart('alternative')
- msg['From']=email_sender
- msg['To']=send_email
- msg['Subject']="Test from Michael's Email program"
- msg.preamble = """Your mail reader does not support the report format."""
- HTML_BODY = MIMEText("BODY", 'html')
- #text = msg.as_string()
- print(msg.as_string(text))
- server=smtplib.SMTP_SSL("smtp.gmail.com",465)
- server.login(email_sender,password)
- server.sendmail(email_sender,send_email,msg.as_string(text))
- server.quit()
Add Comment
Please, Sign In to add comment