首页 > 代码库 > python_smtplib

python_smtplib

import smtplibsmtpserver = smtp.qq.comfromaddr = fromaddr@qq.comtoaddrs = toaddr@qq.commsg = Subject: This message is automatically sent through the python!server = smtplib.SMTP(smtpserver)server.login(fromaddr, password)server.sendmail(fromaddr, toaddrs, msg)server.quit()

用python发邮件需要的条件:发送方的邮箱和密码、接收方的邮箱、发送方邮箱服务器、发送信息(发送标题和内容之间用两个换行符分割)。

python_smtplib