{"record":{"id":"97769144e5a95442","repo":"odysseus-dev/odysseus","slug":"no-smtp-capable-email-account-configured","errorCode":null,"errorMessage":"No SMTP-capable email account configured","messagePattern":"No SMTP-capable email account configured","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mcp_servers/email_server.py","lineNumber":1327,"sourceCode":"    return {\"error\": f\"Email not found in any configured account. Checked: {'; '.join(errors)}\"}\n\n\ndef _smtp_ready(cfg: dict) -> bool:\n    return bool(cfg.get(\"smtp_host\") and cfg.get(\"smtp_user\") and cfg.get(\"smtp_password\"))\n\n\ndef _resolve_send_config(account=None):\n    cfg = _load_config(account)\n    if _smtp_ready(cfg):\n        return account, cfg\n    if account:\n        raise ValueError(f\"Email account {cfg.get('account_name') or account} has no SMTP configured\")\n    for row in _list_accounts_raw():\n        selector = row.get(\"id\") or row.get(\"name\") or row.get(\"imap_user\")\n        trial = _load_config(selector)\n        if _smtp_ready(trial):\n            return selector, trial\n    raise ValueError(\"No SMTP-capable email account configured\")\n\n\ndef _smtp_connect(account=None, cfg=None):\n    \"\"\"Connect to SMTP server, returns logged-in connection.\"\"\"\n    cfg = cfg or _load_config(account)\n    if not _smtp_ready(cfg):\n        raise ValueError(f\"Email account {cfg.get('account_name') or account or 'default'} has no SMTP configured\")\n    port = int(cfg.get(\"smtp_port\") or 465)\n    security = str(cfg.get(\"smtp_security\") or \"\").strip().lower()\n    if security not in {\"ssl\", \"starttls\", \"none\"}:\n        security = \"starttls\" if port == 587 else \"ssl\"\n    if security == \"starttls\":\n        conn = smtplib.SMTP(\n            cfg[\"smtp_host\"],\n            port,\n            timeout=EMAIL_SOCKET_TIMEOUT,\n        )\n        try:","sourceCodeStart":1309,"sourceCodeEnd":1345,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/mcp_servers/email_server.py#L1309-L1345","documentation":"Terminal error from _resolve_send_config: no explicit account was given (or the default config is not SMTP-ready), and the loop over every account row in _list_accounts_raw() found none whose config passes _smtp_ready(). There is literally no account able to send mail.","triggerScenarios":"Calling send_email() with no account argument on a system where zero accounts have smtp_host+smtp_user+smtp_password set (or the accounts DB is empty).","commonSituations":"Fresh install with only IMAP credentials configured; SMTP password field cleared after a credential rotation; smtp_* environment variables not present in the MCP server process env.","solutions":["Configure SMTP (host/port/user/password/security) for at least one account","Confirm the MCP server process can read the SMTP values (DB row or env) — restart it after changes","If the accounts DB is empty, add an account first"],"exampleFix":"# before: no account has SMTP\nsend_email(to='x@y.com', subject='hi', body='hi')\n# after\naccount = {'name':'main','imap_host':'...','smtp_host':'smtp.example.com','smtp_port':465,'smtp_user':'me@example.com','smtp_password':'<app-password>','smtp_security':'ssl'}\nsend_email(account='main', to='x@y.com', subject='hi', body='hi')","handlingStrategy":"validation","validationCode":"if not any(_smtp_ready(_load_config(r.get('id') or r.get('name'))) for r in _list_accounts_raw()):\n    raise SystemExit('No SMTP-capable account configured — add one before sending')","typeGuard":"def any_smtp_capable() -> bool:\n    return any(_smtp_ready(_load_config(r.get('id') or r.get('name') or r.get('imap_user'))) for r in _list_accounts_raw())","tryCatchPattern":"try:\n    acct, cfg = _resolve_send_config()\nexcept ValueError as e:\n    if 'No SMTP-capable' in str(e):\n        fall_back_to_queue_or_log()\n    raise","preventionTips":["Health-check SMTP readiness at service startup","Fail fast on send endpoints when zero SMTP accounts exist","Re-check after credential rotations"],"tags":["email","smtp","configuration"],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}