Created
September 22, 2014 16:45
-
-
Save jatindhankhar/4b878bbb85ded3ed8e61 to your computer and use it in GitHub Desktop.
Simple python script to Mail stuff
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 os | |
import smtplib | |
from email.mime.text import MIMEText import csv | |
with open('/home/jatin/py.csv', 'rb') as f: # Replace path with your file path | |
reader = csv.reader(f) | |
for row in reader: | |
name = row[4] | |
mail = row[5] | |
mess = "Hi {}. Your custom message ".format(name) | |
msg = MIMEText(mess) | |
msg['Subject'] = "Python Workshop Reminder" | |
msg['From'] = "[email protected]" | |
msg['To'] = mail | |
s = smtplib.SMTP('smtp.example.org', 587) | |
# Replace above with your SMTP server and port | |
s.login('[email protected]', 'Password<Here>') | |
s.sendmail(msg['From'], msg['To'], msg.as_string()) | |
s.quit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment