zoukankan      html  css  js  c++  java
  • python实战===使用随机的163账号发送邮件

    import linecache
    import smtplib
    import time
    import linecache
    import random
    
    
    #算出txt的行数,163账号_2.txt中,每一行都存储一个账号密码!
    txt = open(r'F:163账号_2.txt','r') data = txt.read() txt.close() n = data.count(' ') print("总行数",n) #选取随机的数 i = random.randint(1, (n+1)) print("本次使用的行数",i) print("===========================") ###得到对应的i行的数据 line=linecache.getline(r'F:163账号_2.txt',i) #切片实现分离出账号和密码 user = line.split("----")[0] password = line.split("----")[1].replace(' ','') print(user) print(password) try: #发送邮箱的账号/密码 smtpserver = "smtp.163.com" smtp = smtplib.SMTP() smtp.connect(smtpserver) smtp.login(user,password) print("邮箱登陆成功!") print("",(i-1),"行账号有效") time.sleep(1) except: print("邮箱登陆失败,请重新输入!") time.sleep(1)

    *这样虽然可以实现163邮箱的登录,但是可能会被锁定ip

    *备注账号文档在上传的文件:163账号_2.rar

  • 相关阅读:
    02-高阶函数 map filter sorted
    01-切片的赋值操作
    学习资料记录
    django_初级学习(1)
    git配置使用
    openpyxl操作表格(2)
    openpyxl模块操作excell表格(1)
    精简语法
    MySQL常见面试题
    02-图片转字符画
  • 原文地址:https://www.cnblogs.com/botoo/p/7274787.html
Copyright © 2011-2022 走看看