from flask_mail import Message from app import flask_mail from app.mail.messages import messages def send_mail(message: str, recipient: str): body = messages[message]["body"] subject = messages[message]["subject"] msg = Message(subject, recipients=[recipient], body=body) try: flask_mail.send(msg) return True except Exception as e: print(f"Failed to send email. Error: {e}") return False