使用python smtplib库发邮件添加cc,bcc,smtplibbcc,[Python]代码#
使用python smtplib库发邮件添加cc,bcc,smtplibbcc,[Python]代码#
[Python]代码
# -*- coding: cp936 -*-# 甄码农,20120307import smtplibfrom email.mime.text import MIMETextmail_host = 'smtp.126.com'mail_user = 'xxx@126.com'mail_pwd = 'hellopwd'mail_to = 'xxao@gmail.com'mail_cc = 'xx@xx.com'mail_bcc = 'xx@qq.com'content = 'this is a mail sent with python'#表头信息msg = MIMEText(content)msg['From'] = mail_usermsg['Subject'] = 'this is a python test mail'msg['To'] = mail_tomsg['Cc'] = mail_ccmsg['Bcc'] = mail_bcctry: s = smtplib.SMTP() s.connect(mail_host) #login s.login(mail_user,mail_pwd) #send mail s.sendmail(mail_user,[mail_to,mail_cc,mail_bcc],msg.as_string()) s.close() print 'success'except Exception ,e: print e
相关内容
- Python分割文件,python分割,[Python]代码#e
- 自动登录网络设备备份配置文件 version0.2版本,自动登
- 学习和分享,学习分享,[Python]代码#-
- Python 函数的周期性执行,python函数周期性,python sched
- 基于PyQt的Python识别Access密码,pyqtpythonaccess,[Python]代码
- 用来调试嵌入式服务器连接数,写的简单python脚本,嵌
- 利用Flask实现在线Whois 域名查询,flaskwhois,[Python]代码
- (Python学习)CSV电话本,python学习csv电话,CSV电话本#Fil
- 一段阅读英语的小代码,一段阅读英语代码,[Python]代码
- 遍历文件,遍历,[Python]代码im
评论关闭