python - [Solved]flask QQ mailbox mail
某草草
某草草 2017-05-18 11:00:51
0
1
1356

Chapter 6 QQ mailbox used to send emails, tried various methods to no avail

#!/usr/bin/env python 
#coding: utf-8

from flask import Flask

from flask_mail import Mail,Message

import os

app = Flask(__name__)
mail = Mail(app)

app.config['DEBUG'] = True

app.config['MAIL_SERVER'] = 'smtp.qq.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USE_SSL'] = True
app.config['MAIL_USERNAME'] = '1434069**1@qq.com'
app.config['MAIL_PASSWORD'] = 'kfzroq**youejhee'
app.config['MAIL_DEFAULT_SENDER']='1434069**1@qq.com'





@app.route('/')
def index():
        msg = Message(subject='Email test by flask-email',sender="1434069**1@qq.com",recipients=['har**hi@163.com'])
        msg.body = 'hello'
        msg.html = '<b>测试Flask发送邮件<b>'
        mail.send(msg)
#        return '<h1>邮件发送成功</h1>'
if __name__ == '__main__':
    app.run(debug=True)

The code is as above, this is the code used to test the email

This is the setting of QQ mailbox. I have tried ports 25/465/587, USER_NAME @qq.com/, I have tried it with or without @.com, USER_PASSWORD, original password, I have also tried the authorization codes

The error is as follows:
ConnectionRefusedError: [WinError 10061] Unable to connect because the target computer actively refused.
Please ask the boss to solve it

某草草
某草草

reply all(1)
滿天的星座

I’ve been waiting for a whole day and no one has come to help. I’m exhausted. Fortunately, I’ve figured out what’s going on

  • reply Hello, I also encountered the same problem, can you tell me how to solve it?
    phpcn_u110782 author 2018-02-07 18:51:57
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!