Python Mail
来源:互联网 发布:mac战地2 编辑:程序博客网 时间:2024/05/16 08:32
import smtplib
from email.mime.text import MIMEText
mailto_list=[#mail_list]
mail_host="smtp.*.com"
mail_user=username
mail_pass=passwd
mail_postfix="*.com"
def send_mail(to_list,sub,context):
me = mail_user + "<"+mail_user+"@"+mail_postfix+">"
msg = MIMEText(context)
msg['Subject'] = sub
msg['From']= me
msg['To'] = ";".join(to_list)
try:
send_smtp = smtplib.SMTP()
send_smtp.connect(mail_host)
#send_smtp.esmtp_features["auth"]="LOGIN PLAIN"
send_smtp.login(mail_user,mail_pass)
send_smtp.sendmail(me,to_list,msg.as_string())
send_smtp.close()
return True
except Exception,e:
print str(e)
return False
if __name__=='__main__':
if True == send_mail(mailto_list,'Hello World','Hello World 2013'):
print "The Test is successful!"
else:
print "The Test is False!"
0 0
- python-mail
- Python Mail
- python 之 mail
- python mail脚本应用
- Python 發送Mail
- python mail example
- python smtp send mail
- python stmplib send mail
- Python 发送Mail
- python send mail
- python mail sender
- android-junit-report-mail-python
- python发邮件smtplib+mail
- Android屏幕自适应
- VTK修炼之道79:交互与拾取_单位拾取
- Oracle Base
- Oracle Log Type
- Oracle Archive and Noarchive
- Python Mail
- Python Time
- c中的string
- Python & Excel
- Oracle Time
- 万能地图下载器中授权谷歌卫星地图下载器的方法
- Python 工厂函数
- Vim配置#基础开发配置
- Android中Popwindow使用以及背景色变灰