from flask import Flask import os from flask_mail import Mail, Message
app = Flask(name) app.jinja_env.trim_blocks = True app.jinja_env.lstrip_blocks = True
app.config.update( SECRET_KEY=os.getenv('SECRET_KEY', 'secret string'), MAIL_SERVER=os.getenv('MAIL_SERVER'), MAIL_PORT=465, MAIL_USE_SSL=True, MAIL_USERNAME=os.getenv('MAIL_USERNAME'), MAIL_PASSWORD=os.getenv('MAIL_PASSWORD'), MAIL_DEFAULT_SENDER=('ssssssss', os.getenv('MAIL_USERNAME')) )
mail = Mail(app) def send_smtp_mail(subject, to, body): message = Message(subject, recipients=[to], body=body) mail.send(message) if name == 'main': app.run()