Update.
This commit is contained in:
parent
3b57f4cbf6
commit
d957968e6f
@ -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()
|
||||
|
||||
@ -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 = ""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user