Spaces:
Sleeping
Sleeping
| import smtplib | |
| from email.mime.text import MIMEText | |
| from app.core.config import settings | |
| async def send_email_otp(to_email: str, otp: str): | |
| msg = MIMEText(f"Your OTP is {otp}. It is valid for 5 minutes.") | |
| msg["Subject"] = "Your One-Time Password" | |
| msg["From"] = settings.SMTP_FROM | |
| msg["To"] = to_email | |
| server = smtplib.SMTP(settings.SMTP_HOST, settings.SMTP_PORT) | |
| server.starttls() | |
| server.login(settings.SMTP_USER, settings.SMTP_PASS) | |
| server.send_message(msg) | |
| server.quit() |