Fix SMTP defaults and upload validation
This commit is contained in:
@@ -252,18 +252,33 @@ def get_or_create_email_setting(db: Session, tenant_id: int, branch_id: int | No
|
||||
).scalar_one_or_none()
|
||||
if row:
|
||||
return row
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
row = EmailSetting(
|
||||
tenant_id=tenant_id,
|
||||
branch_id=branch_id,
|
||||
smtp_host="smtp.hostinger.com",
|
||||
smtp_port=465,
|
||||
|
||||
# SMTP defaults from Coolify / environment
|
||||
smtp_host=getattr(settings, "SMTP_HOST", None) or "mail.vavalam.com",
|
||||
smtp_port=int(getattr(settings, "SMTP_PORT", 465) or 465),
|
||||
smtp_security="SSL",
|
||||
imap_host="imap.hostinger.com",
|
||||
imap_port=993,
|
||||
smtp_username=getattr(settings, "SMTP_USERNAME", None) or "no-reply@vavalam.com",
|
||||
smtp_password=getattr(settings, "SMTP_PASSWORD", None),
|
||||
|
||||
# Sender defaults
|
||||
from_email=getattr(settings, "SMTP_FROM_EMAIL", None) or "no-reply@vavalam.com",
|
||||
from_name=getattr(settings, "SMTP_FROM_NAME", None) or "ARRR ERP",
|
||||
|
||||
# IMAP defaults from Coolify / environment
|
||||
imap_host=getattr(settings, "IMAP_HOST", None) or "mail.vavalam.com",
|
||||
imap_port=int(getattr(settings, "IMAP_PORT", 993) or 993),
|
||||
imap_security="SSL",
|
||||
|
||||
created_by_user_id=actor_user_id,
|
||||
updated_by_user_id=actor_user_id,
|
||||
)
|
||||
|
||||
db.add(row)
|
||||
db.flush()
|
||||
seed_default_email_templates(db, tenant_id=tenant_id, branch_id=branch_id)
|
||||
|
||||
Reference in New Issue
Block a user