refactor(email): SMTP is now primary for ALL domains, Graph API is legacy fallback only
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:
Maciej Pienczyn 2026-03-30 13:22:05 +02:00
parent 44031dd031
commit 6b586911a1

View File

@ -107,12 +107,12 @@ class EmailService:
Returns:
True if sent successfully, False otherwise
"""
# If sender is @nordabiznes.pl, go directly to SMTP (domain removed from M365)
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)")
# Primary: use SMTP (OVH Zimbra) for all email delivery
smtp_user = os.getenv('SMTP_USER', '')
if smtp_user:
return self._send_via_smtp(subject, body_html or body_text, to, bcc=bcc)
# Legacy fallback: Graph API (only if SMTP not configured and Azure creds present)
if not MSAL_AVAILABLE:
logger.error("msal package not available - cannot send email")
return False