fix: improve SMTP configuration and error handling
- Change default use_tls from True to False to match typical STARTTLS setup - Add MailDeliveryError exception for mail delivery failures - Wrap send_mail calls in try-catch blocks to handle errors gracefully - Return 502 status code with error details when mail delivery fails - Add SMTP security mode selector in frontend (STARTTLS/TLS/None) - Add test mail form to admin panel - Handle empty SMTP credentials properly in update_mail_settings - Catch
This commit is contained in:
@@ -136,7 +136,7 @@ class MailSetting(Base):
|
||||
smtp_port: Mapped[int] = mapped_column(Integer, default=587)
|
||||
smtp_user: Mapped[str | None] = mapped_column(String(220), nullable=True)
|
||||
smtp_password_encrypted: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
use_tls: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
use_tls: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
use_starttls: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
sender_address: Mapped[str | None] = mapped_column(String(320), nullable=True)
|
||||
sender_name: Mapped[str] = mapped_column(String(160), default="NexaPantry")
|
||||
|
||||
Reference in New Issue
Block a user