python模块smtplib安装方法如下,根据你的需要选择执行:
[root@localhost ~]# pip search smtplib
PyEmail (0.0.1) - Python library to send emails using SMTPLIB library
micropython-smtplib (0.0.0) - Dummy smtplib module for MicroPython
personal (0.1.1) - Easy, secure self notification via email and sms, using smtplib and twilio
aiosmtplib (0.1.4) - asyncio version of smtplib
secure-smtplib (0.1.1) - Secure SMTP subclasses for Python 2
mailclient (0.2.0) - Simplified use of smtplib for Python. Easy email sending.
smtplibaio (1.0.3) - An async version of smtplib
easyemail (0.4.0) - Simple lib abstracting email sending with smtplib.
python模块:smtplib模块使用本地的sendmail协议进行邮件发送:
格式(1):smtpObj=smtplib.SMTP([host [,port [,local_hostname]]])
host:SMTP服务器主机的IP地址或者是域名
port:服务的端口号(默认是25)
local_hostname:服务器的地址(默认是localhost)
格式(2):SMTP.sendmail(from_addr),to_addrs,msg[,mail_options,rcpt_options]
from_addr:邮件发送的地址
to_addr:邮件接收地址
msg:发送信息