Commit Graph

1 Commits

Author SHA1 Message Date
97ac7681d2 feat(mail): backend Outlook COM (Windows local) + toggle dans Settings
Resout le probleme de firewall SMTP corporate qui bloque outbound 25/465/587 depuis
les postes de travail. Outlook utilise HTTPS (EWS/Graph) vers O365 -> aucun firewall.

Service mail_outlook_com.py:
- send_via_outlook_com(to, subject, html, cc, display_only): pilote Outlook via COM
  pywin32. Mail apparait dans Sent Items du user, traçable.
- Mode display_only=True ouvre la fenetre de composition Outlook au lieu d'envoyer
  automatiquement (relecture manuelle).
- pythoncom.CoInitialize() pour fonctionner dans un thread uvicorn.

Service mail_service.py:
- send_html_mail dispatche selon Setting 'mail_backend' (smtp / outlook_com).
- Defaut = smtp.

Settings:
- 'mail_backend' = 'smtp' | 'outlook_com'
- 'mail_outlook_display_only' = 'true' | 'false'
- UI: 2 selects en haut de la card SMTP avec hints + le SMTP existant en dessous

Pre-requis Windows: pip install pywin32 + Outlook lance + connecte au compte O365.
2026-05-07 22:24:46 +02:00