Python發送郵件腳本

import smtplib from email.mime.text import MIMEText mailserver = "smtp.163.com" username_send = 'tccwpl@163.com' password = '郵箱的客戶端受權碼' username_recv = '996214487@qq.com' mail = MIMEText('彭彭你好哇') mail['Subject'] = '彭彭' mail['From'] = username_send mail['To'] = username_recv smtp = smtplib.SMTP(mailserver,port=25) # smtp=smtplib.SMTP_SSL('smtp.qq.com',port=465)
smtp.login(username_send,password) smtp.sendmail(username_send,username_recv,mail.as_string()) smtp.quit() print ('success')
相關文章
相關標籤/搜索