fix(email): remove undefined sender_name references in SMTP fallback
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
This commit is contained in:
parent
933e062196
commit
63f87ee951
@ -111,7 +111,7 @@ class EmailService:
|
||||
sender = from_address or self.mail_from
|
||||
if sender and '@nordabiznes.pl' in sender:
|
||||
logger.info(f"Sender is @nordabiznes.pl — using SMTP directly (not Graph API)")
|
||||
return self._send_via_smtp(subject, body_html or body_text, to, sender_name=sender_name, bcc=bcc)
|
||||
return self._send_via_smtp(subject, body_html or body_text, to, bcc=bcc)
|
||||
|
||||
if not MSAL_AVAILABLE:
|
||||
logger.error("msal package not available - cannot send email")
|
||||
@ -181,13 +181,13 @@ class EmailService:
|
||||
logger.error(f"Failed to send email via Graph API. Status: {response.status_code}, Response: {response.text}")
|
||||
# Fallback to SMTP if Graph API fails (e.g. domain removed from M365)
|
||||
logger.info("Attempting SMTP fallback...")
|
||||
return self._send_via_smtp(subject, body, to, sender_name=sender_name, bcc=bcc)
|
||||
return self._send_via_smtp(subject, body, to, bcc=bcc)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Exception during Graph email sending: {e}", exc_info=True)
|
||||
# Fallback to SMTP
|
||||
logger.info("Attempting SMTP fallback after exception...")
|
||||
return self._send_via_smtp(subject, body, to, sender_name=sender_name, bcc=bcc)
|
||||
return self._send_via_smtp(subject, body, to, bcc=bcc)
|
||||
|
||||
def _send_via_smtp(self, subject, body, to, sender_name=None, bcc=None):
|
||||
"""Fallback: send email via SMTP (OVH Zimbra)."""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user