def anonymousEmail(to, subject, message):
br = mechanize.Browser()
url = 'http://anonymouse.org/anonemail.html'
headers = 'Mozilla/4.0 (compatible; MSIE 5.0; AOL 4.0; Windows 95; c_athome)'
br.addheaders = [('User-agent', headers)]
br.open(url)
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_debug_http(False)
br.set_debug_redirects(False)
br.select_form(nr=0)
br.form['to'] = to
br.form['subject'] = subject
br.form['text'] = message
result = br.submit()
response = br.response().read()
# fills all the forms on the website
if 'The e-mail has been sent anonymously!' in response:
print 'Success, the email will be sent shortly'
pause()
main()
else:
print 'Email failed to send'
pause()
main()
# checks response from website
评论列表
文章目录