python发邮件

#*_*coding=utf8*_*


import smtplib


from email.mime.text import MIMEText


smtp = smtplib.SMTP()


smtp.connect('smtp.163.com')


smtp.login('[email protected]', 'XXX')



content =  'XXX'


msg = MIMEText(content, 'html', 'utf-8')

#print(content)


msg['Subject'] = "XXX"


smtp.sendmail('[email protected]', ['[email protected]'], msg.as_string())


smtp.quit()

print('发送成功....')


你可能感兴趣的:(python发邮件)