SHARE
TWEET

How to Send Anonymous Emails with Python

a guest Jul 14th, 2015 3,765 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import mechanize
  2.  
  3. br = mechanize.Browser()
  4.  
  5. to = raw_input("Enter the recipient address: ")
  6. subject = raw_input("Enter the subject: ")
  7. print "Message: "
  8. message = raw_input(">")
  9.  
  10. #proxy = "http://127.0.0.1:8080"
  11.  
  12. url = "http://anonymouse.org/anonemail.html"
  13. headers = "Mozilla/4.0 (compatible; MSIE 5.0; AOL 4.0; Windows 95; c_athome)"
  14. br.addheaders = [('User-agent', headers)]
  15. br.open(url)
  16. br.set_handle_equiv(True)
  17. br.set_handle_gzip(True)
  18. br.set_handle_redirect(True)
  19. br.set_handle_referer(True)
  20. br.set_handle_robots(False)
  21. br.set_debug_http(False)
  22. br.set_debug_redirects(False)
  23. #br.set_proxies({"http": proxy})
  24.  
  25. br.select_form(nr=0)
  26.  
  27. br.form['to'] = to
  28. br.form['subject'] = subject
  29. br.form['text'] = message
  30.  
  31. result = br.submit()
  32.  
  33. response = br.response().read()
  34.  
  35.  
  36. if "The e-mail has been sent anonymously!" in response:
  37.     print "The email has been sent successfully!! \n The recipient will get it in 12 hours!!"
  38. else:
  39.     print "Failed to send email!"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top