feat: Add verify_ssl support for IMAP connections#123
feat: Add verify_ssl support for IMAP connections#123Wh1isper merged 2 commits intoai-zerolab:mainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa513eeac1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
mcp_email_server/emails/classic.py
Outdated
|
|
||
| def _imap_connect(self) -> aioimaplib.IMAP4_SSL | aioimaplib.IMAP4: | ||
| """Create a new IMAP connection with the configured SSL context.""" | ||
| return self.imap_class(self.email_server.host, self.email_server.port, ssl_context=self.imap_ssl_context) |
There was a problem hiding this comment.
Guard ssl_context kwarg for non-SSL IMAP clients
When an account is configured with use_ssl=False (port 143/plain IMAP), this path still calls aioimaplib.IMAP4(..., ssl_context=...); ssl_context is only valid on the SSL client constructor, so non-SSL client creation raises before login/search/delete can run. That means this change breaks a supported configuration (MCP_EMAIL_SERVER_IMAP_SSL=false) for all code paths using _imap_connect (and the same instantiation pattern appears in append_to_sent).
Useful? React with 👍 / 👎.
fa513ee to
07e3850
Compare
for more information, see https://pre-commit.ci
Summary
MCP_EMAIL_SERVER_IMAP_VERIFY_SSLenv var andimap_verify_sslconfig parameter (default:true) to control SSL certificate verification for IMAP connections, matching existing SMTPverify_sslsupport_imap_connect()helper, includingappend_to_sent