用最简单方法解决api接口安全问题,几乎无法破解
docker运行gunicorn看不到控制台输出

利用qq邮箱作为个人邮件服务器发送邮件

妙音 posted @ 2019年4月06日 07:47 in python with tags 运维 , 1033 阅读
 需求描述
    邮件通知很有用处。如何搭建一个邮件服务器,允许发送邮件呢?
 

实现方法

 
一、利用开源软件,搭建自己的邮件服务器。
二、利用qq等第三方邮件服务。
 
自己搭邮件服务器较麻烦,我的需求比较简单,利用qq邮件,发送邮件即可,下面是方法.
 
 
 

设置方法

 
1.开启服务,获取授权码
邮箱设置-->帐户-->开启"IMAP/SMTP服务"
 
 
 
开启成功后,会给出一个授权码.
授权码就是发送邮件时的密码
 
2.python发送邮件
 
# -*- coding:utf-8 -*-
import smtplib
from email.mime.text import MIMEText
from email.header import Header

# 第三方 SMTP 服务
mail_host="smtp.qq.com"
mail_user="开启stmp服务器qq邮箱@qq.com"
mail_pass="授权码xxxx"   #口令/授权码


sender = 'sender@qq.com'
receivers = ['接收者@ikasinfo.com']

message = MIMEText('邮件发送测试...', 'plain', 'utf-8')
message['From'] = Header("测试", 'utf-8')
message['To'] =  Header("测试", 'utf-8')

subject = '邮件测试'
message['Subject'] = Header(subject, 'utf-8')

smtpObj = smtplib.SMTP_SSL()
smtpObj.connect(mail_host, 465)    # 465为SMTP加密端口号
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(sender, receivers, message.as_string())
print("邮件发送成功")
 
此生必看的科学实验-水知道答案
《了凡四训》详解之改过之法
印光大师十念法(胡小林主讲第1集)
精神病为什么治不好
百病之源
 
 
Avatar_small
Latest foreign music 说:
2019年9月02日 03:44

That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more.

Avatar_small
f88tw 说:
2019年10月20日 17:46

敬啟者:個人小網站希望大家多多支持
感謝您對我們熱心的支持
f88tw|華歌爾|I appreciate your kind assistance.

http://mypaper.pchome.com.tw/f88tw/P1

http://mypaper.pchome.com.tw/f88tw/post/1379131888

 <a data-cke-saved-href="http://mypaper.pchome.com.tw/f88tw" href="http://mypaper.pchome.com.tw/f88tw" "="" style="box-sizing: border-box; background: 0px 0px rgb(255, 255, 255); color: rgb(66, 139, 202); text-decoration-line: none; transition: all 0.1s ease-in-out 0s; font-family: &quot;Roboto Condensed&quot;, sans-serif; font-size: 14px;">http://mypaper.pchome.com.tw/f88tw

禁忌|撿骨師|新竹|時間|台北|桃園|苗栗|頭份

Avatar_small
f88tw┃华歌尔 说:
2019年12月28日 08:49

敬启者:个人小网站希望大家多多支持 感谢您对我们热心的支持 f88tw┃华歌尔┃I appreciate your kind assistance. f88tw|墓园|捡骨流程|捡骨费用|捡骨时间|禁忌|捡骨颜色|捡骨师|新竹|时间|台北|桃园|苗栗|头份|火化|晋塔|安葬|法事|捡骨|看日子|墓穴|墓园|坟墓

Avatar_small
run 3 说:
2020年2月13日 12:39

The information is very good, I think it is difficult because I have just started.

Avatar_small
run 3 说:
2020年2月13日 12:40

If you agree I want to retrieve article information, harmony is needed

Avatar_small
thermal imaging syd 说:
2020年2月25日 10:33

I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. thermal imaging sydney

Avatar_small
luxury car rental US 说:
2020年3月06日 16:21

I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best!

Avatar_small
sunroom builders syd 说:
2020年3月08日 12:33

Hey, this day is too much good for me, since this time I am reading this enormous informative article here at my home. Thanks a lot for massive hard work. sunroom builders sydney


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter