Skip to content

Instantly share code, notes, and snippets.

@jatindhankhar
Created September 22, 2014 16:45
Show Gist options
  • Save jatindhankhar/4b878bbb85ded3ed8e61 to your computer and use it in GitHub Desktop.
Save jatindhankhar/4b878bbb85ded3ed8e61 to your computer and use it in GitHub Desktop.
Simple python script to Mail stuff
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'] = "bot@quiksort.in"
msg['To'] = mail
s = smtplib.SMTP('smtp.example.org', 587)
# Replace above with your SMTP server and port
s.login('bot@quiksort.in', '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