Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. ########################################################
  2. ''' SMTP_Email by i-s-e-K --> twitter.com/_isek_ <-- '''
  3. ########################################################
  4.  
  5. # Imports standard modules
  6. from os import system
  7. from email.mime.text import MIMEText
  8. import smtplib
  9.  
  10. # Clears the command line
  11. cls = lambda: system('cls')
  12.  
  13. def email(SERVER, USER, PASS, TO, SUBJECT, MESSAGE):
  14. # Remaining parts of an email
  15. PORT = 587
  16. FROM = USER
  17.  
  18. # Creates an email
  19. message = MIMEText(MESSAGE)
  20. message['From'] = FROM
  21. message['To'] = ','.join(TO)
  22. message['Subject'] = SUBJECT
  23.  
  24. # Sends an email
  25. email = smtplib.SMTP()
  26. email.connect(SERVER,PORT)
  27. email.starttls()
  28. email.login(USER,PASS)
  29. email.sendmail(FROM, TO, message.as_string())
  30. email.quit()
  31.  
  32. cls()
  33.  
  34. # Asks for parts of an email
  35. SERVER = raw_input('Enter the server: ')
  36. USER = raw_input('Enter the username with @domain.tld: ')
  37. PASS = raw_input('Enter the password: ')
  38. TO = [raw_input('Enter the recipient [for more than one use comma]: ')]
  39. SUBJECT = raw_input('Enter the subject: ')
  40. MESSAGE = raw_input('Enter the message: ')
  41.  
  42. email(SERVER, USER, PASS, TO, SUBJECT, MESSAGE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement