from flask import Flask
from flask_mail import Mail, Message

app = Flask(__name__)
app.config.update(
MAIL_SERVER='smtp.qq.com',
MAIL_PORT='465',
MAIL_USE_SSL=True,
MAIL_USERNAME='你的QQ号',
MAIL_PASSWORD='邮箱密码'
)

mail = Mail(app)

@app.route('/')
def index():
msg = Message(subject="mongo", sender='发送者邮箱', recipients=['接收者邮箱'])
msg.html='<h1>hello world!</h1>'
mail.send(msg)
return "hello_world"

if __name__ == '__main__':
app.run()

相关文章:

  • 2022-01-26
  • 2021-12-21
  • 2022-12-23
  • 2021-06-12
  • 2022-02-09
  • 2021-06-04
  • 2022-03-05
  • 2021-09-05
猜你喜欢
  • 2021-07-13
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案