send_Email

from email.mime.text import MIMEText
import smtplib

msg = MIMEText('hello, send by Python...', 'plain', 'utf-8')

# 输入Email地址和口令:
from_addr = "[email protected]"
password = "533123"
# 输入SMTP服务器地址:
smtp_server = "smtp.126.com"
# 输入收件人地址:
to_addr = "[email protected]"

server = smtplib.SMTP(smtp_server, 25)  # SMTP协议默认端口是25server.set_debuglevel(1)
server.login(from_addr, password)
server.sendmail(from_addr, [to_addr], msg.as_string())
server.quit()

猜你喜欢

转载自blog.csdn.net/qq_42426237/article/details/81534155