From d957968e6f632908797a028d300fb01477485707 Mon Sep 17 00:00:00 2001 From: retoor Date: Tue, 11 Nov 2025 15:20:14 +0100 Subject: [PATCH] Update. --- rbox/mail.py | 8 ++++---- rbox/settings.py | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/rbox/mail.py b/rbox/mail.py index 8287bb9..56edb48 100644 --- a/rbox/mail.py +++ b/rbox/mail.py @@ -60,12 +60,12 @@ class EmailService: async def _send_email_task(self, task: EmailTask): """Send a single email task""" - if not settings.SMTP_SERVER or not settings.SMTP_USERNAME or not settings.SMTP_PASSWORD: + if not settings.SMTP_HOST or not settings.SMTP_USERNAME or not settings.SMTP_PASSWORD: print("SMTP not configured, skipping email send") return msg = MIMEMultipart('alternative') - msg['From'] = settings.SMTP_FROM_EMAIL + msg['From'] = settings.SMTP_SENDER_EMAIL msg['To'] = task.to_email msg['Subject'] = task.subject @@ -81,7 +81,7 @@ class EmailService: try: if settings.SMTP_PORT == 465: async with aiosmtplib.SMTP( - hostname=settings.SMTP_SERVER, + hostname=settings.SMTP_HOST, port=settings.SMTP_PORT, username=settings.SMTP_USERNAME, password=settings.SMTP_PASSWORD, @@ -91,7 +91,7 @@ class EmailService: print(f"Email sent to {task.to_email}") else: async with aiosmtplib.SMTP( - hostname=settings.SMTP_SERVER, + hostname=settings.SMTP_HOST, port=settings.SMTP_PORT, ) as smtp: await smtp.starttls() diff --git a/rbox/settings.py b/rbox/settings.py index 5cff292..ab8f1f2 100644 --- a/rbox/settings.py +++ b/rbox/settings.py @@ -18,11 +18,12 @@ class Settings(BaseSettings): S3_SECRET_ACCESS_KEY: str | None = None S3_ENDPOINT_URL: str | None = None S3_BUCKET_NAME: str = "rbox-storage" - SMTP_SERVER: str | None = None + SMTP_HOST: str = "mail.example.com" SMTP_PORT: int = 587 - SMTP_USERNAME: str | None = None - SMTP_PASSWORD: str | None = None - SMTP_FROM_EMAIL: str = "no-reply@example.com" + SMTP_USERNAME: str = "noreply@example.com" + SMTP_PASSWORD: str = "your-smtp-password" + SMTP_USE_TLS: bool = True + SMTP_SENDER_EMAIL: str = "noreply@example.com" TOTP_ISSUER: str = "RBox" STRIPE_SECRET_KEY: str = "" STRIPE_PUBLISHABLE_KEY: str = ""