Skip to content

feat: Add verify_ssl support for IMAP connections#123

Merged
Wh1isper merged 2 commits intoai-zerolab:mainfrom
crionuke:feat/imap-verify-ssl
Feb 19, 2026
Merged

feat: Add verify_ssl support for IMAP connections#123
Wh1isper merged 2 commits intoai-zerolab:mainfrom
crionuke:feat/imap-verify-ssl

Conversation

@crionuke
Copy link
Contributor

Summary

  • Add MCP_EMAIL_SERVER_IMAP_VERIFY_SSL env var and imap_verify_ssl config parameter (default: true) to control SSL certificate verification for IMAP connections, matching existing SMTP verify_ssl support
  • Pass SSL context to all IMAP connections via a new _imap_connect() helper, including append_to_sent
  • Update README env vars table and self-signed certificates section

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mcp_email_server/emails/classic.py 76.4% 3 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@Wh1isper
Copy link
Member

@codex

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".


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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@crionuke crionuke force-pushed the feat/imap-verify-ssl branch from fa513ee to 07e3850 Compare February 19, 2026 12:06
@Wh1isper Wh1isper merged commit 28631b5 into ai-zerolab:main Feb 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants