python写一个邮箱伪造脚本

前言:

原本打算学php MVC的思路然后写一个项目。但是贼恶心,

写不出来。然后就还是用python写了个邮箱伪造。

0x01

第一步先去搜狐注册一个邮箱

然后,点开设置,开启SMTP服务。

当然你也可以用其他的邮箱,

1开启SMTP服务

0x02

代码分析

import smtplib
from email.mime.text import MIMEText
from email.header import Header
zhengwen=input('请输入正文:')
fajianr=input('请输入发件人:')
shoujianr=input('请输入收件人:')
zhuti=input('主题:')
messeng=MIMEText(zhengwen,'plain','utf-8')#正文
messeng['From']=Header(fajianr,'utf-8')#发件人
messeng['TO']=Header(shoujianr,'utf-8')#收件人
subject=zhuti#主题
messeng['Subject']=Header(subject,'utf-8')
def yxwz():
  try:
    smtp=smtplib.SMTP()
    smtp.connect('smtp.sohu.com','25')
    smtp.login('你的搜狐邮箱','你搜狐的密码')
  smtp.sendmail('你的搜狐邮箱'['目标邮箱'],messeng.as_string())
    smtp.quit()
    print('[*]邮件发送成功')
  except Exception as e:
      print('[-]发送失败,报错原因:',e)
yxwz()

  运行截图

 github地址:https://github.com/422926799/python

原文地址:https://www.cnblogs.com/haq5201314/p/8328772.html