Advertisement
Guest User

Untitled

a guest
Mar 16th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. enter any key to exit
  2. enter 'spam' to spam an email
  3. Enter: spam
  4. Running..Running..Running..Running..Running..Running..Running..Traceback (most recent call last):
  5. File "C:UsersLeonDesktopProgettiGdazeGdaze.py", line 61, in <module>
  6. emailSetupAndGo(getData()[0], getData()[1], getData()[2], getData()[3], getData()[4], getData()[5])
  7. File "C:UsersLeonDesktopProgettiGdazeGdaze.py", line 46, in emailSetupAndGo
  8. server = smtplib.SMPT('smtp.gmail.com:587')
  9. AttributeError: module 'smtplib' has no attribute 'SMPT'
  10.  
  11. import smtplib
  12. import sys
  13.  
  14. def getData():
  15. #GETTING DATA FROM THE FILE
  16. configFile = open('config.txt', 'rt')
  17. usernameLine = configFile.readline()
  18. passwordLine = configFile.readline()
  19. nLine = configFile.readline()
  20. fromemailLine = configFile.readline()
  21. toemailLine = configFile.readline()
  22. msgLine = configFile.readline()
  23. configFile.close()
  24. if "<yourgmail's>" in usernameLine:
  25. sys.stderr.write("NoSettings ERROR: modify the config.txt file before you run the program.")
  26. elif "<yourgmail's>" in passwordLine:
  27. sys.stderr.write("NoSettings ERROR: modify the config.txt file before you run the program.")
  28. elif "<int>" in nLine:
  29. sys.stderr.write("NoSettings ERROR: modify the config.txt file before you run the program.")
  30. elif "<youremail>" in fromemailLine:
  31. sys.stderr.write("NoSettings ERROR: modify the config.txt file before you run the program.")
  32. elif "<emailtospam>" in toemailLine:
  33. sys.stderr.write("NoSettings ERROR: modify the config.txt file before you run the program.")
  34. elif "<msg>" in msgLine:
  35. sys.stderr.write("NoSettings ERROR: modify the config.txt file before you run the program.")
  36. else:
  37. sys.stdout.write("Running..")
  38. #DECLARING THE MAIN VARIABLES
  39. u = str(usernameLine[11:])
  40. pw = str(passwordLine[11:])
  41. n = str(nLine[27:])
  42. fromemail = str(fromemailLine[12:])
  43. toemail = str(toemailLine[10:])
  44. msg = str(msgLine[10:])
  45. #DELETING SPACES IN THE FILE TO STORE CORRECTLY THE DATA
  46. u.split(" ")
  47. pw.split(" ")
  48. n.split(" ")
  49. fromemail.split(" ")
  50. toemail.split(" ")
  51. msg.split(" ")
  52. data = [u, pw, n, fromemail, toemail, msg]
  53. return data
  54.  
  55. def emailSetupAndGo(n, username, password, fromemail, toemail, message):
  56. server = smtplib.SMPT('smtp.gmail.com:587')
  57. server.starttls()
  58. server.login(username, password)
  59. for i in n:
  60. server.sendmail(fromemail, toemail, message)
  61. server.quit()
  62.  
  63. def help():
  64. sys.stdout.write("enter any key to exitnenter 'spam' to spam an emailn")
  65.  
  66. while True:
  67. help()
  68. entered = input("Enter: ")
  69. if entered == 'spam':
  70. getData()
  71. emailSetupAndGo(getData()[0], getData()[1], getData()[2], getData()[3], getData()[4], getData()[5])
  72. else:
  73. break
  74.  
  75. username = <yourgmail's>
  76. password = <yourgmail's>
  77. number of emails to spam = <int>
  78. fromemail = <youremail>
  79. toemail = <emailtospam>
  80. message = <msg>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement