您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Python 发送邮件 smtplib

2024/4/9 9:25:36发布12次查看
可以利用smtplib模块来实现发送邮件的功能,一个比较简单的实例代码如下:
# import smtplib for the actual sending function import smtplib # import the email modules we'll need from email.mime.text import mimetext # open a plain text file for reading. for this example, assume that # the text file contains only ascii characters. # create a text/plain message msg = mimetext("some content") me = you = 'somebody@somewhere.com' # me == the sender's email address # you == the recipient's email address msg['subject'] = 'the contents of somebody' msg['from'] = me msg['to'] = you # send the message via our own smtp server, but don't include the # envelope header. s = smtplib.smtp('localhost') s.sendmail(me, [you], msg.as_string()) s.quit()
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product