/***************************************************************************
* 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. 使用JS来实现验证码功能

    最近想为自己的Django博客添加验证码功能,本来想使用第三方库来实现的,不过考虑到添加第三方库对性能的影响,以及第三方库是否安全可靠的问题,还是用自己的代码来实现吧.反正用JS来实现验证码功能又不是 ...

  2. Python OS模块标准库的系统接口及操作方法

    Python OS模块标准库的系统接口及操作方法 os.name 返回当前操作系统名,定义了'posix','nt','mac','os2','ce','java'(我使用win7/python3.1 ...

  3. WPF中让TextBlock每一个字符显示不同的颜色

    XAML代码: <TextBlock x:Name="tb"> <Run Foreground="Red">R</Run> ...

  4. Oracle的AUTOTRACE功能

    ORACLE9i在使用autotrace之前,需要作一些初始设置: 1.用sys用户运行脚本utlxplan.sql创建PLAN_TABLE表 脚本目录:(UNIX:$ORACLE_HOME/rdbm ...

  5. 3DSoftRenderer

    研究了好几天基本的图形学,对于光栅化的大致过程有点了解了,很感谢网上的很多大牛的无私奉献,我就写一下这几天的总结,希望也能对网络上的知识做出一点点点的贡献. 屏幕有什么特点,无非是一排排的像素点,每个 ...

  6. 【android-cocos2d-X2.2 环境配置】在Mac下搭建Cocos2d-X-android开发环境!

    仅用于cocos2d-X2.2--cocos2d-X3.4 原文地址:http://blog.csdn.net/dingkun520wy/article/details/17097593 (1)下载 ...

  7. Struts 2 Tutorials

    http://www.dzone.com/tutorials/java/struts-2/struts-2-tutorial/struts-2-tutorial.html http://struts. ...

  8. uva 1421

    稍微有点新意的二分 #include<cstdio> #include<cstring> #include<algorithm> #include<cmath ...

  9. Firefly的角色跳转场景简单示例

    源地址:http://bbs.9miao.com/thread-45790-1-2.html 本例演示的是模拟游戏服务端,让角色在场景1中跳转到场景2中.在实际游戏中,client将要跳转的角色id和 ...

  10. 双十一运维怎么过,OneAPM 帮你救火,轻松运维

    一年一度的双十一来了 有人剁手买买买,有人愁眉苦脸抱着服务器哭 对,说的就是你,汪 苦逼的运维工程师双十一怎么过来的? 守着电脑看预警还是通宵加服务器扩容 还是帮女朋友守着购物车等着一键清空 或者 今 ...