python自带模块发送邮件
# -*- coding: UTF-8 -*-
import smtplib
from email.mime.text import MIMEText
msg = MIMEText('hello, send by Python...', 'plain', 'utf-8')
from_addr = '****@163.com'
password = '***'
to_addr = '*****@163.com'
smtp_server = 'smtp.163.com'
#-------------------------
server = smtplib.SMTP(smtp_server, 25) # SMTP协议默认端口是25
server.set_debuglevel(1)
server.login(from_addr, password)
server.sendmail(from_addr, [to_addr], msg.as_string())
server.quit()