import smtplib
from email.mime.text import MIMEText mail_user = "user1@qq.com"
mail_pwd = "password"
mailto_list=["user2@qq.com", "user3@qq.com"] def send_mail(from_address, to_address_list, mail_subject, mail_content):
msg = MIMEText(mail_content)
msg["Subject"] = mail_subject
msg['From'] = from_address
msg['To'] = ";".join(to_address_list) s = smtplib.SMTP("smtp.qq.com", timeout=30)#连接smtp邮件服务器,端口默认是25
#s = smtplib.SMTP_SSL("smtp.qq.com", 465) #连接方法一
#s = smtplib.SMTP() #连接方法二
#s.connect(mail_host)
s.login(from_address, mail_pwd)
s.sendmail(from_address, to_address_list, msg.as_string())
#s.quit()
s.close() send_mail(mail_user, mailto_list, '群发主题', '群发内容')

python发送QQ邮箱方法的更多相关文章

  1. C# WinForm 使用SMTP协议发送QQ邮箱验证码

    文章来自:https://blog.csdn.net/IT_xiao_guang_guang/article/details/104336604 前言   在程序设计中,发送验证码是常见的一个功能,用 ...

  2. Python使用SSL方式发送QQ邮箱

    #coding:utf-8 import smtplib from email.mime.text import MIMEText from email.header import Header # ...

  3. 九、Python发送QQ邮件(SMTP)

    看了廖雪峰老师的教程: 一封电子邮件的旅程就是 发件人 -> MUA -> MTA -> MTA -> 若干个MTA -> MDA <- MUA <- 收件人 ...

  4. Python使用QQ邮箱发送邮件报错smtplib.SMTPAuthenticationError

    最新在学习Python的基础入门系列课程,今天学习到使用python 的内置库smtplib发送邮件内容. 使用Python发送邮件步骤简单: 创建SMTP连接 使用邮箱和密码登录SMTP服务器 创建 ...

  5. 使用python发送QQ邮件

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

  6. Python发送QQ邮件

    #!/usr/bin/python # -*- coding: UTF-8 -*-    import smtplib from email.mime.text import MIMEText fro ...

  7. Thinkphp3.2 PHPMailer 发送 QQ邮箱 163邮箱

    在进入正题这前先看下网易(163)邮箱的服务器地址和端口号 类型 服务器名称 服务器地址 SSL协议端口号 非SSL协议端口号 收件服务器 POP pop.163.com 995 110 收件服务器 ...

  8. php 发送QQ邮箱邮件

    这是我的源码比较简陋 https://www.lanzous.com/i2l7h8f 感谢 https://www.cnblogs.com/woider/p/6980456.html 下载phpmai ...

  9. python 向qq邮箱发邮件

    #coding:utf-8 ''' Created on 2017-1-12 @author: xiaochun ''' import smtplib from email.mime.text imp ...

随机推荐

  1. Wannafly挑战赛17 B

    题解 大概就是求证这个 \[\sum_i^nC_{n}^i*C_n^i = C_{2n}^n\] 证明: \[(1+x)^{2n} = [C(0,n)+C(1,n)*x+...+C(n,n)*x^n] ...

  2. 工作中用到的git命令

    1.git stash 将本地的修改藏匿,不进行commit也可切换分支 2.git stash apply 将之前藏匿的修改恢复出来 3.git cherry-pick commitId git在当 ...

  3. bzoj 2342: [Shoi2011]双倍回文 -- manacher

    2342: [Shoi2011]双倍回文 Time Limit: 10 Sec  Memory Limit: 128 MB Description Input 输入分为两行,第一行为一个整数,表示字符 ...

  4. Codeforces Beta Round #5 B. Center Alignment 模拟题

    B. Center Alignment 题目连接: http://www.codeforces.com/contest/5/problem/B Description Almost every tex ...

  5. Codeforces Beta Round #80 (Div. 1 Only) D. Time to Raid Cowavans 分块

    D. Turtles Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/103/problem/D ...

  6. ORACEL 创建表空间

    注意点: 1.如果在PL/SQL 等工具里打开的话,直接修改下面的代码中[斜体加粗部分]执行 2.确保路径存在,比如[D:\oracle\oradata\Oracle9i\]也就是你要保存文件的路径存 ...

  7. FreeRTOS介绍与移植

    http://andyhuzhill.github.io/freertos/2013/07/30/freertostransplant/ 最近在看一个实时嵌入式操作系统————FreeRTOS, 为什 ...

  8. Jquery UI 中Tree组件的json格式,java递归拼接demo

    数据库中表数据,如下图: 实现的需求是,如果suporgcode数据为null 的情况下,表示在一级节点 "请选择" 的二级节点,然后是如:3和36 是1的子节点,一步一步的节点延 ...

  9. source insight完全卸载

    由于不知名原因 source insight崩溃了,使用自带的卸载,完成之后重新安装软件注册还是出问题.在网上搜索资料发现就是删除注册表中的内容. 由于列出的删除项目不完全,导致还是出问题. 最后删除 ...

  10. SASS输出风格

    嵌套输出方式 nested sass --watch test.scss:test.css --style nested 嵌套输出方式 expanded sass --watch test.scss: ...