Guest User

Untitled

a guest
Jun 13th, 2017
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import cgi
  2. import cgitb
  3. import smtplib
  4.  
  5. cgitb.enable()
  6.  
  7.  
  8. IMAP_HOST = "smtp.yandex.ru"
  9. IMAP_PORT = 465
  10. USERNAME = "[email protected]"
  11. PASSWORD = "********"
  12.  
  13. form = cgi.FieldStorage()
  14.  
  15. lines = []
  16. lines.append("From: %s" % USERNAME)
  17. lines.append("To: %s" % SENDTO)
  18. lines.append("")
  19.  
  20. if not form.getfirst("check"):
  21. for var in form:
  22. if var == "check":
  23. continue
  24. lines.append("%s = %s" % (var, form.getfirst(var, "-")))
  25.  
  26. conn = smtplib.SMTP_SSL(IMAP_HOST, IMAP_PORT)
  27. conn.login(USERNAME, PASSWORD)
  28. conn.sendmail(SENDTO, USERNAME, "\n".join(lines))
  29. conn.quit()
  30.  
  31. print "Content-type: text/plain"
  32. print
  33. print "OK"
Advertisement
Add Comment
Please, Sign In to add comment