Skip to content

Commit ccb2c0b

Browse files
Jamie Kirkpatrickclaude
andcommitted
feat: add verify_ssl option for SMTP connections
Add MCP_EMAIL_SERVER_SMTP_VERIFY_SSL environment variable to disable SSL certificate verification for SMTP connections. Useful for local mail servers with self-signed certificates (e.g., ProtonMail Bridge). Defaults to true (verify certificates). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d9e62c6 commit ccb2c0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mcp_email_server/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class EmailServer(BaseModel):
2929
port: int
3030
use_ssl: bool = True # Usually port 465
3131
start_ssl: bool = False # Usually port 587
32+
verify_ssl: bool = True # Set to False for self-signed certificates (e.g., ProtonMail Bridge)
3233

3334
def masked(self) -> EmailServer:
3435
return self.model_copy(update={"password": "********"})
@@ -96,6 +97,7 @@ def init(
9697
smtp_port: int = 465,
9798
smtp_ssl: bool = True,
9899
smtp_start_ssl: bool = False,
100+
smtp_verify_ssl: bool = True,
99101
smtp_user_name: str | None = None,
100102
smtp_password: str | None = None,
101103
save_to_sent: bool = True,
@@ -119,6 +121,7 @@ def init(
119121
port=smtp_port,
120122
use_ssl=smtp_ssl,
121123
start_ssl=smtp_start_ssl,
124+
verify_ssl=smtp_verify_ssl,
122125
),
123126
save_to_sent=save_to_sent,
124127
sent_folder_name=sent_folder_name,
@@ -141,6 +144,7 @@ def from_env(cls) -> EmailSettings | None:
141144
- MCP_EMAIL_SERVER_SMTP_PORT (default: 465)
142145
- MCP_EMAIL_SERVER_SMTP_SSL (default: true)
143146
- MCP_EMAIL_SERVER_SMTP_START_SSL (default: false)
147+
- MCP_EMAIL_SERVER_SMTP_VERIFY_SSL (default: true)
144148
- MCP_EMAIL_SERVER_SAVE_TO_SENT (default: true)
145149
- MCP_EMAIL_SERVER_SENT_FOLDER_NAME (default: auto-detect)
146150
"""
@@ -183,6 +187,7 @@ def parse_bool(value: str | None, default: bool = True) -> bool:
183187
smtp_port=int(os.getenv("MCP_EMAIL_SERVER_SMTP_PORT", "465")),
184188
smtp_ssl=parse_bool(os.getenv("MCP_EMAIL_SERVER_SMTP_SSL"), True),
185189
smtp_start_ssl=parse_bool(os.getenv("MCP_EMAIL_SERVER_SMTP_START_SSL"), False),
190+
smtp_verify_ssl=parse_bool(os.getenv("MCP_EMAIL_SERVER_SMTP_VERIFY_SSL"), True),
186191
smtp_user_name=os.getenv("MCP_EMAIL_SERVER_SMTP_USER_NAME", user_name),
187192
smtp_password=os.getenv("MCP_EMAIL_SERVER_SMTP_PASSWORD", password),
188193
imap_user_name=os.getenv("MCP_EMAIL_SERVER_IMAP_USER_NAME", user_name),

0 commit comments

Comments
 (0)