18 email

18.1 项目简介

电子邮件包是用于管理电子邮件的库。它不是专门设计用来向SMTP(rfc2821)、NNTP或其他服务器发送电子邮件;这些是smtplib和nntplib等模块的功能。电子邮件包试图尽可能符合RFC,支持rfc5233和rfc6532,以及与MIME相关的RFC,如rfc2045、rfc2046、rfc2047、rfc2183和rfc2231。

18.2 项目地址

https://github.com/python/cpython/blob/3.8/Lib/email/__init__.py

18.3 文档地址

https://docs.python.org/3/library/email.html

18.4 最佳实践

import smtplib
from  email.mime.text import MIMEText

send_user = '840964310@qq.com'
send_user_password = 'uuwtbwzklbwjbbjh'
receive_user = 'a112121788@163.com'


email_msg = MIMEText('正文,纯文本')

email_msg['Subject'] = '主题'
email_msg['From'] = send_user
email_msg['To'] = receive_user


# 准备发送
s = smtplib.SMTP_SSL('smtp.qq.com',465)
s.login(send_user, send_user_password)

# 发送邮件
s.sendmail(send_user, receive_user, email_msg.as_string())


© pengpeng 本站总访问量修改时间: 2020-07-26

results matching ""

    No results matching ""