昨天用python模块给自己发了第一封电子邮件,真是激动

今天完善了一下。

code:

 import smtplib
from email.mime.text import MIMEText//email #包中加载部分功能
from email.header import Header sever = smtplib.SMTP_SSL()#加密传输
sever.connect('smtp.qq.com',465)#链接服务器 username =input('使用邮箱')
password =input('授权码')
to_addrs =['xxx.@qq.com']

sever.login(username,password) text='''
this is a good time!
my frist letters from python.
hope eveything.''' msg=MIMEText(text,'plain','utf-8')#发送文本内容
msg['From']=Header(username)
msg['To']=Header(",".join(to_addrs))
msg['Subject']=Header('welcom from python') try:
sever.sendmail(username,to_addrs,msg.as_string())
except:
print('发送失败,请重试') sever.quit()

The frist email to myself by python的更多相关文章

  1. Send Email in Robot Framework Python Using Gmail

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

  2. python操作email

    python操作email 参考链接: python官网imaplib: https://docs.python.org/2/library/imaplib.html Python 用IMAP接收邮件 ...

  3. Python Email发送,通知业务完成

    Email 发送 #!/usr/bin/python # -*- coding: UTF-8 -*- import base64 import smtplib from email.mime.text ...

  4. Python 3.4 send mail

    #coding=utf-8 #Python 3.4 https://docs.python.org/3.4/library/ #IDE:Visual Studio 2015 Window10 impo ...

  5. 使用python发送和接收邮件

    关于电子邮件 大学之前,基本不用邮箱,所以基本感觉不到它的存在,也不知道有什么用:然而大学之后,随着认识的人越来越多,知识越来越广泛,邮箱已然成为很重要的通讯工具,大学一些课程作业需要有邮箱发给老师, ...

  6. python基础第三天(1)

    函数 函数分为:内置函数,自定义函数,导入函数. 内置函数 python为咱们提供的快捷方式 vars()---针对脚本的,找到这个脚本中的所有变量. #!/usr/bin/env python # ...

  7. Python基础之【第三篇】

    dir(): 默认打印当前模块的所有属性,如果传一个对象参数则打印当前对象的变量名 vars() 默认打印当前模块的所有属性,如果传一个对象参数则打印当前对象的变量名和值 reload() 将以前导入 ...

  8. Python全栈之路3--set集合--三元运算--深浅拷贝--初识函数

    一.上节课的重点回顾: 1.类名加括号其实就是执行类的__init__方法: 2.int a.创建方式 n1 = 123 #根据int类创建了一个对象 n2 = int(123) #根据int类创建一 ...

  9. 使用python发送QQ邮件

    这里用到了Python的两个包来发送邮件: smtplib 和 email . Python 的 email 模块里包含了许多实用的邮件格式设置函数,可以用来创建邮件“包裹”.使用的 MIMEText ...

随机推荐

  1. 堆应用---构造Huffman树(C++实现)

    堆: 堆是STL中priority_queue的最高效的实现方式(关于priority_queue的用法:http://www.cnblogs.com/flyoung2008/articles/213 ...

  2. 从Word Embedding到Bert模型—自然语言处理中的预训练技术发展史(转载)

    转载 https://zhuanlan.zhihu.com/p/49271699 首发于深度学习前沿笔记 写文章   从Word Embedding到Bert模型—自然语言处理中的预训练技术发展史 张 ...

  3. orcle数据库表中字段值含有单引号,如何模糊搜索?

    例如:T_table表中,name字段值为:字符串含有‘单引号’: SQL模糊搜索语句应该如下:select * from T_table where name like '%含有''单引号''%'

  4. 开启IIS的WebGarden、WebFarm和StateServer之旅

    前言 公司系统虽然配置有1台NLB后拖4台App Server最后搭一台强劲无比的DB Server,但每天下午4点左右总被投诉系统慢,报表下载不了等问题.究其原因,原来NLB采用锁定sessionI ...

  5. C++自己实现一个String类

    C++自己实现一个String类(构造函数.拷贝构造函数.析构函数和字符串赋值函数) #include <iostream> #include <cstring> using ...

  6. nodejs的package.json依赖dependencies中 ^ 和 ~ 的区别

    nodejs的package.json定义了一个模块,包括其依赖关系的一个简单的JSON文件,该文件可以包含多个不同的指令来告诉Node包管理器如何处理模块. dependencies则表示此模块依赖 ...

  7. char *p[] 和char**的思考

    char *p[] = {"hello","world"}; char **pp; pp = p; printf("%s,%s\n",*pp ...

  8. cURL error 60: SSL certificate problem: unable to get local issuer

    github 问题连接 https://github.com/yabacon/paystack-php/wiki/cURL-error-60:-SSL-certificate-problem:-una ...

  9. @validated 验证 List 参数在spring中

    @PostMapping(value = "complete") public Vo complete(@Valid @RequestBody @Validated(Complet ...

  10. iframe 加form提交数据

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...