Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- import string
- import MySQLdb
- from email.MIMEMultipart import MIMEMultipart
- from email.MIMEText import MIMEText
- import randPass #the code for this module is available at http://pastebin.com/8GxjYcrX
- handle=MIMEMultipart()
- handle["Subject"]=" Confirmation Email from <GEC Git Repo> "
- db = MySQLdb.connect(host="localhost",user="<>",passwd="<>",db="<>")
- cursor=db.cursor()
- server = smtplib.SMTP("smtp.gmail.com:587")
- server.starttls()
- query="select * from Accounts"
- cursor.execute(query)
- row=cursor.fetchone()
- while row:
- randword=randPass.gen()
- query=" update Accounts set passwd=SHA('"+randword+"') "
- cursor.execute(query)
- handle["To"]=row[3]
- message=''' This is a computer generated Email.Please note That reply to this address may not be monitered
- You have received this mail as you have requested for confirmation code of GEC GitRepository.
- Here are your account details:
- Username : ''' + row[0] +'''
- Confirmation Code : ''' + randword + '''
- if you have no idea what is happening , please ignore this mail
- Some body might have entered your Mail Id by mistake. '''
- handle.attach(MIMEText(message))
- row = cursor.fetchone()
- server.quit()
Advertisement
Add Comment
Please, Sign In to add comment