1. 程式人生 > >python trojan development 1st —— use python to send mail

python trojan development 1st —— use python to send mail

end lib all pri nbsp passwd smtp con text

 1 import smtplib
 2 from email.mime.text import MIMEText
 3 msg_from=[email protected]                                 #發送方郵箱
 4 passwd=bd                                   #填入發送方郵箱的授權碼
 5 msg_to=[email protected]
 6 
 7 
 8 subject="python郵件測試"                                     #主題
 9 content="這是我使用python smtplib及email模塊發送的郵件
" 10 msg = MIMEText(content) 11 msg[Subject] = subject 12 msg[From] = msg_from 13 msg[To] = msg_to 14 try: 15 s = smtplib.SMTP_SSL("smtp.qq.com",465) 16 s.login(msg_from, passwd) 17 s.sendmail(msg_from, msg_to, msg.as_string()) 18 print( "發送成功") 19 except: 20 print
("發送失敗") 21 finally: 22 s.quit()

python trojan development 1st —— use python to send mail