MCPcopy
hub / github.com/dataelement/Clawith / resolve_config

Function resolve_config

backend/app/services/email_service.py:91–112  ·  view source on GitHub ↗

Resolve a user config into full IMAP/SMTP settings using provider presets.

(config: dict)

Source from the content-addressed store, hash-verified

89
90
91def resolve_config(config: dict) -> dict:
92 """Resolve a user config into full IMAP/SMTP settings using provider presets."""
93 provider = config.get("email_provider", "custom")
94 result = {
95 "email_address": config.get("email_address", ""),
96 "auth_code": config.get("auth_code", ""),
97 "imap_host": config.get("imap_host", ""),
98 "imap_port": int(config.get("imap_port", 993)),
99 "smtp_host": config.get("smtp_host", ""),
100 "smtp_port": int(config.get("smtp_port", 465)),
101 "smtp_ssl": config.get("smtp_ssl", True),
102 }
103
104 if provider != "custom" and provider in EMAIL_PROVIDERS:
105 preset = EMAIL_PROVIDERS[provider]
106 result["imap_host"] = preset["imap_host"]
107 result["imap_port"] = preset["imap_port"]
108 result["smtp_host"] = preset["smtp_host"]
109 result["smtp_port"] = preset["smtp_port"]
110 result["smtp_ssl"] = preset["smtp_ssl"]
111
112 return result
113
114
115def _decode_header_value(value: str) -> str:

Callers 4

send_emailFunction · 0.85
read_emailsFunction · 0.85
reply_emailFunction · 0.85
test_connectionFunction · 0.85

Calls 1

getMethod · 0.45

Tested by 1

test_connectionFunction · 0.68