前言:
原本打算學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
