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('\n') 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('\n','') 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

转载于:https://www.cnblogs.com/botoo/p/7274787.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值