Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Note: You need to turn on access for less secure apps on your gmail account in order for this to work
- import smtplib
- import sys
- import time
- try:
- email = raw_input("What is your gmail?\n")
- password = raw_input("What is your password?\n")
- recipient = raw_input("Who is the recipient of the e-mail?\n")
- # subject = raw_input("What should the subject of the e-mail be?\n")
- message = raw_input("What message would you like to send?\n")
- count = int(raw_input("How many messages would you like to send?\n"))
- # message = "Subject: {}\n\n{}".format(subject, message)
- except ValueError:
- print "Invalid inputs."
- sys.exit()
- def send_email(email, password, recipient, msg):
- server = smtplib.SMTP("smtp.gmail.com", 587)
- server.starttls()
- server.login(email, password)
- server.sendmail(email, recipient, msg)
- server.quit()
- def main():
- num = 0
- start = time.time()
- while num < count:
- send_email(email, password, recipient, message)
- num += 1
- print "Email has been sent. {} left.".format(str(count-num))
- print "It took {0:.2f} seconds to complete.".format(time.time()-start)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement