Add "prefer SMTP" toggle to skip Microsoft Graph for email
When the M365 connector is connected the app always tries Graph first, and a Graph 202 ends the send — so report mail to recipients Exchange silently drops (Google-hosted subdomains of the O365 domain) never reaches them, even with working SMTP configured. New prefer_smtp flag gates all three Graph branches (smtp_test, send_report, _maybe_send_auto_email) so they go straight to SMTP. UI toggle #st-smtpPreferSmtp in Settings → E-mailrapport, saved/loaded by scheduler.js, with da/de/en strings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
526e2b0b78
commit
874c3ccec1
8 files changed
+20
-5
No files matched your search
+8
-4
@@ -148,8 +148,12 @@ def smtp_test():
|
||||
"</body></html>"
|
||||
)
|
||||
|
||||
# Try Graph API first
|
||||
if state.connector and state.connector.is_authenticated():
|
||||
# Try Graph API first — unless the user opted to always use SMTP. Graph
|
||||
# returns 202 (queued) even for recipients Exchange later silently drops
|
||||
# (e.g. a Google-hosted subdomain of the O365 domain), so SMTP is the only
|
||||
# reliable path for those; prefer_smtp forces it.
|
||||
prefer_smtp = bool(saved.get("prefer_smtp"))
|
||||
if state.connector and state.connector.is_authenticated() and not prefer_smtp:
|
||||
try:
|
||||
_send_email_graph(subject, body_html, recipients)
|
||||
return jsonify({"ok": True, "method": "graph", "recipients": recipients})
|
||||
@@ -285,8 +289,8 @@ def send_report():
|
||||
"</body></html>"
|
||||
)
|
||||
|
||||
# Try Graph API first
|
||||
if state.connector and state.connector.is_authenticated():
|
||||
# Try Graph API first — unless prefer_smtp is set (see smtp_test for why).
|
||||
if state.connector and state.connector.is_authenticated() and not smtp_cfg.get("prefer_smtp"):
|
||||
try:
|
||||
_send_email_graph(subject, body_html, recipients,
|
||||
attachment_bytes=xl_bytes, attachment_name=fname)
|
||||
|
||||
Reference in new issue
Block a user