-
-
Save mdb2301/9e6b2b39a9f0e3f6060f4335df5e04a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask_mail import Mail, Message | |
import os | |
app = Flask(__name__) | |
app.app_context().push() | |
app.config['MAIL_SERVER'] = 'smtp.googlemail.com' | |
app.config['MAIL_USE_TLS'] = True | |
app.config['MAIL_PORT'] = 587 | |
app.config['MAIL_USERNAME'] = os.environ.get('EMAIL') | |
app.config['MAIL_PASSWORD'] = os.environ.get('PASS') | |
mail = Mail(app) | |
to = ['man**********@gmail.com'] | |
msg_body = "This is a mail sent from flask app. Do not reply to this message. Have a nice day!" | |
sub = "Test email for password reset" | |
msg = Message(subject=sub,recipients=to,body=msg_body,sender='noreply@gmail.com') | |
mail.send(msg) | |
if __name__ == "__main__": | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment