python send email
#!/usr/bin/python
# -*- coding: UTF-8 -*- # coding:utf8
from smtplib import SMTP_SSL
from email.header import Header
from email.mime.text import MIMEText mail_info = {
"from": "vickeywu557@gmail.com",
"to": "vickeywu557@gmail.com",
"hostname": "smtp.gmail.com",
"username": "vickeywu557@gmail.com",
"password": "",
"mail_subject": "test",
"mail_text": "hello, this is a test email, sended by py",
"mail_encoding": "utf-8"
} if __name__ == '__main__':
# 这里使用SMTP_SSL就是默认使用465端口
smtp = SMTP_SSL(mail_info["hostname"])
smtp.set_debuglevel(1) smtp.ehlo(mail_info["hostname"]) smtp.login(mail_info["username"], mail_info["password"]) msg = MIMEText(mail_info["mail_text"], "plain", mail_info["mail_encoding"])
msg["Subject"] = Header(mail_info["mail_subject"], mail_info["mail_encoding"])
msg["from"] = mail_info["from"]
msg["to"] = mail_info["to"] smtp.sendmail(mail_info["from"], mail_info["to"], msg.as_string()) smtp.quit()
参考【https://www.cnblogs.com/inva/p/5115794.html】
python send email的更多相关文章
- Try to write a script to send e-mail but failed
#-*-coding: utf-8 -*- '''使用Python去发送邮件但是不成功,运行后,等待一段时间, 返回[Errno 10060] A connection attempt failed ...
- python auto send email
/*************************************************************************** * python auto send emai ...
- Send Email in Robot Framework Python Using Gmail
转载自:http://seleniummaster.com/sitecontent/index.php/selenium-robot-framework-menu/selenium-robot-fra ...
- [Python] 发送email的几种方式
python发送email还是比較简单的,能够通过登录邮件服务来发送,linux下也能够使用调用sendmail命令来发送,还能够使用本地或者是远程的smtp服务来发送邮件,无论是单个,群发,还是抄送 ...
- python操作email
python操作email 参考链接: python官网imaplib: https://docs.python.org/2/library/imaplib.html Python 用IMAP接收邮件 ...
- 通过 python 处理 email - Email via Python
Email via Python 1 MIME - Multipurpose Internet Mail Extensions SMTP - Simple Message Transport Prot ...
- Python 发送 email 的两种方式
Python发送email的两种方式,分别为使用登录邮件服务器.调用sendmail命令来发送三种方法 Python发送email比较简单,可以通过登录邮件服务来发送,linux下也可以使用调用sen ...
- 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调用email模块发送邮件附件
使用python调用email模块实现附件发送 需要模块: import datetime import time import sys import mimetypes import smtplib ...
随机推荐
- 使用css borer实现图层蒙版效果
需要js 思路:假设目标元素是target.在外层定义元素宽高等于target,通过border设置元素铺满整个文档,设置border的透明图,实现蒙版,在元素的内部设置子元素,宽高100%;设置圆角 ...
- 从0开始学习Hadoop(2) 环境准备-Win7主机与Ubuntu虚拟机共享文件夹设置
主机要跟虚拟机共享文件夹设置有很多种办法,这里提供一种本地用户的方式 1. 新增一个本地用户,密码等其他设置如下 2.选择文件目录,这是共享属性 Ubuntu端设置: 文件夹->连接到网络-&g ...
- 在Centos下安装httpd、php、Mysql并配置(转载)
转自:http://club.jledu.gov.cn/?action-viewspace-itemid-299020 1.安装Apahce, PHP, Mysql, 以及php连接mysql库组件. ...
- Codeforces785D - Anton and School - 2
传送门 题意 给出一个只包含'(',')'的字符序列,询问有多少个\(RSBS\) 分析 首先需要知道一个公式 \[\sum_{i=0}^{min(x,y)}C_x^i*C_y^i=C_{x+y}^x ...
- bzoj 1027: [JSOI2007]合金【凸包+Floyd】
参考:https://www.cnblogs.com/zhuohan123/p/3237246.html 因为一c可以由1-a-b得出,所以删掉c,把a,b抽象成二维平面上的点.首先考虑一个客户需求能 ...
- 使用pabot并行执行robotframework用例
主要观点:使用pabot并行运行robotframework,可以解决:robotframework执行案例时间长的问题 解决执行案例时间长的方案: 目的: 缩短案例的运行时间 两种方法: 将大的项目 ...
- 《windows核心编程系列》十九谈谈使用远程线程来注入DLL。
windows内的各个进程有各自的地址空间.它们相互独立互不干扰保证了系统的安全性.但是windows也为调试器或是其他工具设计了一些函数,这些函数可以让一个进程对另一个进程进行操作.虽然他们是为调试 ...
- Radis
http://www.redis.cn/ http://try.redis.io/ http://www.redisdoc.com/en/latest/ Redis 命令参考¶ 本文档是 Redis ...
- c#中stringbuilder的方法总结
String 对象是不可改变的.每次使用 System.String 类中的方法之一时,都要在内存中创建一个新的字符串对象,这就需要为该新对象分配新的空间.在需要对字符串执行重复修改的情况下,与创建新 ...
- sqlServer备份和还原语句
数据库备份语句和还原语句: --完整备份 Backup Database xxx To disk=’G:\Backup\xxx.bak’ --查看物理路径 restore filelistonly f ...