import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
MAIL_SERVER = 'smtp.qq.com'
MAIL_PORT = 25
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
FLASKY_MAIL_SUBJECT_PREFIX = '[Flasky]'
FLASKY_MAIL_SENDER = 'Flasky Admin <flasky@example.com>'
FLASKY_ADMIN = os.environ.get('FLASKY_ADMIN')
@staticmethod
def init_app(app):
pass
直接从GITHUB上抄下来的,那几个邮箱值不知道该改哪几个?可能不止一处错误
报错是
raise SMTPSenderRefused(code, resp, from_addr)
smtplib.SMTPSenderRefused: (503, b'Error: need EHLO and AUTH first !', '=?utf-8?q?Flasky_Admin?= <flasky@example.com>')
Change to your qq account or 163 email account
I forgot how to do it specifically. Please take a look at the code I wrote before. . . I am also free
You can refer to the project I wrote, flask-lovehate
MAIL_USERNAME is the mailbox. Is MAIL_PASSWORD authorized by QQ Mail? It can be obtained by opening it in the mailbox background. FLASKY_MAIL_SENDER can be set to the same as MAIL_USERNAME.