python-发邮件

python 发邮件 
  

# Import smtplib for the actual sending functionimport smtplib# Import the email modules we'll needfrom email.mime.text import MIMEText# Open a plain text file for reading.  For this example, assume that# the text file contains only ASCII characters.fp = open(textfile, 'rb')# Create a text/plain messagemsg = MIMEText(fp.read())fp.close()# me == the sender's email address# you == the recipient's email addressmsg['Subject'] = 'The contents of %s' % textfilemsg['From'] = memsg['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()

登录后复制

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。

发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2281848.html

(0)
上一篇 2025年2月27日 18:59:40
下一篇 2025年2月23日 18:42:30

AD推荐 黄金广告位招租... 更多推荐

发表回复

登录后才能评论