Fix email notification SMTP to support STARTTLS (port 587)#2225
Open
Fix email notification SMTP to support STARTTLS (port 587)#2225
Conversation
|
|
Collaborator
|
@bar-jpg, can you double-check if the change was committed correctly? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix email notification SMTP to support STARTTLS (port 587)
Analysis
Let me search the codebase to find the email notification implementation in workflows.You've found a real bug. Here's a complete breakdown:
Root Cause: Hardcoded
SMTP_SSL— No STARTTLS SupportBoth
v1andv2of the Email Notification block always usesmtplib.SMTP_SSL, which is correct only for port465(implicit SSL). They have zero support for STARTTLS (port587), which is what most modern SMTP servers (Office 365, AWS SES, Postfix, SendGrid, etc.) require.The two connection models:
smtplibcallsmtplib.SMTP_SSL(host, 465)✅smtplib.SMTP(host, 587)+.starttls()✅smtplib.SMTP(host, 25)Affected code
v1 —
establish_smtp_connection(line 494–496):v2 —
_send_email_using_smtp_server_v2(line 1057–1059):Also note: the
smtp_portfield description in both manifests explicitly says587 for TLS (not supported)— so this is a known limitation that was never fixed.The Fix
The
establish_smtp_connectionhelper needs to detect the port and pick the right connection strategy:In
v1.py— replaceestablish_smtp_connection:In
v2.py— apply the same fix to theestablish_smtp_connectionnested function inside_send_email_using_smtp_server_v2(lines ~1057–1060), and also update the manifest description to remove the587 (not supported)wording.Workaround (for users right now)
If your SMTP provider supports it, use port
465instead of587. That's the only port that currently works. If your server mandates587(e.g., Office 365, some corporate SMTP relays), you're blocked until the fix is deployed.Files Changed
inference/core/workflows/core_steps/sinks/email_notification/v1.pyinference/core/workflows/core_steps/sinks/email_notification/v2.py