# -*- coding: utf-8 -*- from email.header import Header
from email.mime.text import MIMEText
import smtplib def sendmail(subject, content):
sender = '' # 发件人邮箱
password = '' # 发件人邮箱密码
recipients = '' # 收件人邮箱
host = '' # 发件人邮箱主机 msg = MIMEText(content, 'plain', 'utf-8')
msg['From'] = sender
msg['To'] = recipients
msg['Subject'] = Header(subject, 'utf-8').encode() server = smtplib.SMTP(host, 25)
server.login(sender, password)
server.sendmail(sender, [recipients], msg.as_string())
server.quit()
相关文章
- 01-17Python——SMTP发送邮件
- 01-17使用Python SMTP发送邮件
- 01-17python通过SMTP发送邮件失败,报错505/535
- 01-17python实现邮件发送完整代码(带附件发送方式)
- 01-17利用python发送qq邮件
- 01-17Python 发送邮件
- 01-17CDH平台yarn下发送邮件中文乱码
- 01-17python 发送邮件,未完
- 01-17python发送邮件
- 01-17python – 如何在发送电子邮件后从服务器获取响应?