/***************************************************************************
* python auto send email
* 声明:
* 本文主要是记录如何使用python的smtplib发邮件,中间遇到授权密码和邮箱
* 密码不同的问题。
*
* 2016-2-17 深圳 南山平山村 曾剑锋
**************************************************************************/ 一、参考文章:
163邮箱报错WARN: Error: authentication failed.啥问题?
http://www.zhihu.com/question/32009096 二、error:
. 错误现象:
(, 'Error: authentication failed')
. 解决办法:
smtplib用的邮箱登入密码是授权密码,不是邮箱密码。授权密码需要在邮箱设置中设置,我用的是163的邮箱,所以需要在163邮箱中设置。 三、demo code:
# encoding: utf-
import smtplib sender = "zengjf42@163.com"
receivers = ["64128306@qq.com"] message = """From: zengjf <zengjf42@163.com>
To: zoro <@qq.com>
Subject: test email for python this is a test email.
""" try:
smtpObj = smtplib.SMTP()
smtpObj.connect("smtp.163.com", "")
# 千万请注意下面的password是授权密码,不是邮箱的密码。
# 授权密码需要在163邮箱设置中设置。
state = smtpObj.login("zengjf42@163.com", "填入授权密码")
if state[] == :
smtpObj.sendmail(sender, receivers, message)
print "send email success"
smtpObj.quit()
except smtplib.SMTPException, e:
print str(e)

python auto send email的更多相关文章

  1. Send Email in Robot Framework Python Using Gmail

    转载自:http://seleniummaster.com/sitecontent/index.php/selenium-robot-framework-menu/selenium-robot-fra ...

  2. Try to write a script to send e-mail but failed

    #-*-coding: utf-8 -*- '''使用Python去发送邮件但是不成功,运行后,等待一段时间, 返回[Errno 10060] A connection attempt failed ...

  3. Robot Framework通过Python SMTP进行email收发测试。

    工作中需要对发送的邮件进行过滤,方法基本属于ACL控制,即查看“源/目的”邮件地址,邮件标题,邮件正文,邮件附件等进行过滤. 所以需要先模拟一下用Python能否达到邮件Client,Server的功 ...

  4. python trojan development 1st —— use python to send mail and caputre the screen then combine them

    import smtplib from email.mime.text import MIMEText msg_from='1@qq.com' #发送方邮箱 passwd='bd' #填入发送方邮箱的 ...

  5. Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email

    Check SMTP Server Availability for ORA-29278 or ORA-29279 errors using UTL_SMTP to Send Email. (文档 I ...

  6. Python中send()和sendall()的区别

    Python中send()和sendall()的区别 估计每个学习Python网络编程的人,都会遇到过这样的问题: send()和sendall()到底有什么区别? send()和sendall()原 ...

  7. 5 Ways to Send Email From Linux Command Line

    https://tecadmin.net/ways-to-send-email-from-linux-command-line/ We all know the importance of email ...

  8. [476] Database Mail is not enabled for agent notifications. Cannot send e-mail to

    配置完DB Mail后JOB的的通知邮件不能发送,日志报错476] Database Mail is not enabled for agent notifications. Cannot send ...

  9. python send email

    #!/usr/bin/python # -*- coding: UTF-8 -*- # coding:utf8 from smtplib import SMTP_SSL from email.head ...

随机推荐

  1. Hello World for U (20)

    Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. ...

  2. nginx+php-fpm 502 bad gateway

    输出日志配置: http://blog.csdn.net/wzy_1988/article/details/8486888 解决方案: http://www.cnblogs.com/jackluo/p ...

  3. MINA快速传输文件

    最近的项目使用MNA进行文件传输,只能传输到5~7MB/s:但是使用FTP等软件其实可以达到11MB/s,后来使用MINA原生传输,发现可以达到11MB/s,后来发现有以下两点可以需要注意优化: 1. ...

  4. oc 中四种实例变量的范围类型@private@protected@public@package

    To enforce the ability of an object to hide its data, the compiler limits the scope of instance vari ...

  5. AForm

    相信大部分程序员都接触过表单,表单是收集用户输入的不二之选,但是表单的开发又是最繁琐.最复杂的,简单地说,开发表单你需要涉及到很多知识: 布局,表单如何布局排版,看起来最清晰整洁,且符合用户体验 控件 ...

  6. [转载]JQuery的Ajax跨域请求的解决方案

    今天在项目中需要做远程数据加载并渲染页面,直到开发阶段才意识到ajax跨域请求的问题,隐约记得Jquery有提过一个ajax跨域请求的解决方式,于是即刻翻出Jquery的API出来研究,发现JQuer ...

  7. Flume学习——BasicTransactionSemantics

    org.apache.flume.channel.BasicTransactionSemantics An implementation of basic Transaction semantics ...

  8. Codeforces Round #242 (Div. 2) A~C

    题目链接 A. Squats time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputou ...

  9. jmeter summariser(命令行执行时的输出) 、查看结果树等结果中文乱码

    在使用jmeter测试时,如果你的sampler名字为中文.或者输出的结果信息有中文,你会发现它们都是乱码,非常蛋碎!原因是:  jmeter的默认编码为:ISO-8859-1, 解决方案就是要修改它 ...

  10. Maven for Myeclipse的一个常见错误 Project configuration is not up-to-date with pom.xml

    使用Myeclipse开发Maven项目时,经常会发现一个错误提示: Description Resource Path Location Type Project configuration is ...