fix: add smtp ssl - #30248
Conversation
Greptile SummaryThis PR fixes a hang when users configure LiteLLM's SMTP integration against a server that requires implicit SSL (port 465). It extracts two helpers —
Confidence Score: 4/5Safe to merge; the change is narrowly scoped to SMTP connection setup and does not touch the request-handling or auth paths. The logic for choosing between SMTP_SSL and plain SMTP is correct, the isinstance guard before starttls() is necessary and present, and port-587 users see no behaviour change. The only gap is that _create_smtp_connection lacks a direct test to verify it returns the right connection type. tests/test_litellm/proxy/test_proxy_utils.py — a test for _create_smtp_connection would improve coverage of the actual branching logic.
|
| Filename | Overview |
|---|---|
| litellm/proxy/utils.py | Extracts _should_use_smtp_ssl and _create_smtp_connection helpers; skips starttls() when SMTP_SSL is used; fixes hang on port 465 implicit-SSL servers |
| tests/test_litellm/proxy/test_proxy_utils.py | Adds three unit tests for _should_use_smtp_ssl covering port 465, explicit SMTP_USE_SSL=True, and port 587; _create_smtp_connection itself is not tested |
Reviews (1): Last reviewed commit: "add smtp ssl" | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 2 · PR risk: 0/10 |
yassin-berriai
left a comment
There was a problem hiding this comment.
veria score is 7/10. fix ci issues and get acceptable veria score
* fix: add smtp ssl (#30248) * add smtp ssl * fix comments' * fix(proxy): verify SMTP server certificate on starttls * dont read ssl from env * test(proxy): restore regression test for SMTP_TLS=False starttls skip --------- Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
* fix: add smtp ssl (BerriAI#30248) * add smtp ssl * fix comments' * fix(proxy): verify SMTP server certificate on starttls * dont read ssl from env * test(proxy): restore regression test for SMTP_TLS=False starttls skip --------- Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
* fix: add smtp ssl (BerriAI#30248) * add smtp ssl * fix comments' * fix(proxy): verify SMTP server certificate on starttls * dont read ssl from env * test(proxy): restore regression test for SMTP_TLS=False starttls skip --------- Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
* fix: add smtp ssl (BerriAI#30248) * add smtp ssl * fix comments' * fix(proxy): verify SMTP server certificate on starttls * dont read ssl from env * test(proxy): restore regression test for SMTP_TLS=False starttls skip --------- Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
* fix: add smtp ssl (BerriAI#30248) * add smtp ssl * fix comments' * fix(proxy): verify SMTP server certificate on starttls * dont read ssl from env * test(proxy): restore regression test for SMTP_TLS=False starttls skip --------- Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
* fix: add smtp ssl (BerriAI#30248) * add smtp ssl * fix comments' * fix(proxy): verify SMTP server certificate on starttls * dont read ssl from env * test(proxy): restore regression test for SMTP_TLS=False starttls skip --------- Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
Relevant issues
LIT-2665
uses SSL by default - user would only have to configure smtp as stated in these docs
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
make test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
CI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Screenshots / Proof of Fix
Type
🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test
Changes