miguelgrinberg / flasky

Companion code to my O'Reilly book "Flask Web Development", second edition.
MIT License
8.52k stars 4.2k forks source link

Flask mail returning mail as exception #544

Closed Godwinprince closed 1 year ago

Godwinprince commented 1 year ago

hello i am actually new to flask python, i am developing a small web app but i have been faced with this flask error for weeks. her is the code.

from flask_mail import Mail, Message app = Flask(name)

app.config['MAIL_SERVER'] = 'mailserver' app.config['MAIL_PORT'] = 465 app.config['MAIL_USERNAME'] = email server username app.config['MAIL_PASSWORD'] = email server password app.config['MAIL_DEBUG'] = True app.config['MAIL_USE_TLS'] = False app.config['MAIL_USE_SSL'] = True app.config['MAIL_SUPPRESS_SEND'] = False app.config['TESTING'] = False mail = Mail(app)

@routes.route('/', methods =['GET', 'POST']) def index():

try:
    msg = Message('Welcome To RicoEasyPay', sender='hi@ricoeasypay.com', recipients=['charlesgodwin54@gmail.com'])
    msg.body = ('Welcome to RicoEasyPay, We make life easy by making you financially stable')
    mail.send(msg)
    response = 'ok'
except Exception as e:
    pass
    response = e

now the thing is the python code returns mail as its exception. i am really confused now, please can some one help me?

miguelgrinberg commented 1 year ago

I'm sorry, but this is an issue tracker for the Flask Web Development book. You may want to consider posting on Stack Overflow or in a Flask-Mail discussion forum.