python auto send email
/***************************************************************************
* 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的更多相关文章
- Send Email in Robot Framework Python Using Gmail
转载自:http://seleniummaster.com/sitecontent/index.php/selenium-robot-framework-menu/selenium-robot-fra ...
- Try to write a script to send e-mail but failed
#-*-coding: utf-8 -*- '''使用Python去发送邮件但是不成功,运行后,等待一段时间, 返回[Errno 10060] A connection attempt failed ...
- Robot Framework通过Python SMTP进行email收发测试。
工作中需要对发送的邮件进行过滤,方法基本属于ACL控制,即查看“源/目的”邮件地址,邮件标题,邮件正文,邮件附件等进行过滤. 所以需要先模拟一下用Python能否达到邮件Client,Server的功 ...
- 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' #填入发送方邮箱的 ...
- 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 ...
- Python中send()和sendall()的区别
Python中send()和sendall()的区别 估计每个学习Python网络编程的人,都会遇到过这样的问题: send()和sendall()到底有什么区别? send()和sendall()原 ...
- 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 ...
- [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 ...
- python send email
#!/usr/bin/python # -*- coding: UTF-8 -*- # coding:utf8 from smtplib import SMTP_SSL from email.head ...
随机推荐
- linux 输入子系统(4)---- input子系统的初始化
Input子系统的初始化函数为input_init(),如下: static int __init input_init(void) { int err; input_init_abs_bypass( ...
- 实现c++的string的split功能
今天写程序,遇到了一个要实现string.split()这个的一个函数.python里面有,qt里面有,c++里面没有.照着网上抄了一个,放在这里.有需要的时候直接拽过去用,否则老是写了小例子就扔,用 ...
- 使用tolua++编译pkg,从而创建自定义类让Lua脚本使用
步骤一:首先自定义类(这里Himi自定义类名 “MySprite”) MySprite.h 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 // // ...
- 关于Eigen库在Visual Studio2013中传参对齐报错问题
Error as follow: 具体问题及解决办法描述如下: (引自http://www.fx114.net/qa-278-97757.aspx) /************************ ...
- s3c2440之cache
cache高速缓冲存储器注意与块设备页高速缓存进行区别,一个是硬件的实现一个是软件的实现,块设备页高速缓存. s3c2440/s3c2410里面主要有一个arm920t的核,但同时包含几个协处理器,协 ...
- Xcode 向6.0以后版本添加iOS开发空白模板
打开finder,找到应用程序,找到xcode 右键显示包内容.按照如下目录进行查找:Contents ▸ Developer ▸ Platforms ▸ iPhoneOS.platform ▸ De ...
- 1014: [JSOI2008]火星人prefix - BZOJ
Description 火星人最近研究了一种操作:求一个字串两个后缀的公共前缀.比方说,有这样一个字符串:madamimadam,我们将这个字符串的各个字符予以标号:序号: 1 2 3 4 5 6 7 ...
- Linux下使用GDB调试程序
问题描述: Linux下使用GDB调试程序 问题解决: (1)生成调试文件 注: 使用命令 gdb IOStream.c -o IOStre ...
- 解决VS如何同时打开两个工程(xp和win7)
http://www.360doc.com/content/11/1020/00/7891073_157586269.shtml
- [转载]VS2012程序打包部署详解
上篇博客把收费系统的总体设计进行了一遍讲解,讲解的同时掺杂了些有关.NET编译机制的总结.程序编写测试完成后接下来我们要做的是打包部署程序,但VS2012让人心痛的是没有了打包工具.不知道出于什么原因 ...