from flask_mail import Message from flask import current_app from .extensions import mail def send_otp(email, otp): msg = Message( subject="Your OTP Code", sender=current_app.config["MAIL_USERNAME"], recipients=[email] ) msg.body = f"Your OTP is {otp}" mail.send(msg)