MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / EmailConfig

Class EmailConfig

keepercommander/email_service.py:151–284  ·  view source on GitHub ↗

Email configuration for sending emails via various providers. Stored as Keeper records (login type) with encrypted credentials. See ADR Decision 1 in ONBOARDING_FEATURE_IMPLEMENTATION_PLAN.md Supported providers: - smtp: Standard SMTP with username/password - ses: AWS Simp

Source from the content-addressed store, hash-verified

149
150@dataclass
151class EmailConfig:
152 """
153 Email configuration for sending emails via various providers.
154
155 Stored as Keeper records (login type) with encrypted credentials.
156 See ADR Decision 1 in ONBOARDING_FEATURE_IMPLEMENTATION_PLAN.md
157
158 Supported providers:
159 - smtp: Standard SMTP with username/password
160 - ses: AWS Simple Email Service
161 - sendgrid: SendGrid API
162 - gmail-oauth: Gmail with OAuth 2.0 (uses Gmail API)
163 - microsoft-oauth: Microsoft 365/Outlook with OAuth 2.0 (uses Graph API)
164 """
165 record_uid: str
166 name: str
167 provider: str # 'smtp', 'ses', 'sendgrid', 'gmail-oauth', 'microsoft-oauth'
168 from_address: str
169 from_name: str = "Keeper Commander"
170
171 # SMTP-specific
172 smtp_host: Optional[str] = None
173 smtp_port: int = 587
174 smtp_username: Optional[str] = None
175 smtp_password: Optional[str] = None
176 smtp_use_tls: bool = True
177 smtp_use_ssl: bool = False
178
179 # AWS SES-specific
180 aws_region: Optional[str] = None
181 aws_access_key: Optional[str] = None
182 aws_secret_key: Optional[str] = None
183
184 # SendGrid-specific
185 sendgrid_api_key: Optional[str] = None
186
187 # OAuth-specific (gmail-oauth, microsoft-oauth)
188 oauth_client_id: Optional[str] = None
189 oauth_client_secret: Optional[str] = None
190 oauth_access_token: Optional[str] = None
191 oauth_refresh_token: Optional[str] = None
192 oauth_token_expiry: Optional[str] = None # ISO 8601 format
193 oauth_scopes: Optional[List[str]] = None
194 oauth_tenant_id: Optional[str] = None # For Microsoft 365 (can be 'common', 'organizations', or specific tenant ID)
195
196 # Additional metadata
197 custom_fields: Dict[str, Any] = field(default_factory=dict)
198
199 # Internal flag to track OAuth token updates (not stored in Keeper)
200 _oauth_tokens_updated: bool = field(default=False, init=False)
201
202 def validate(self) -> List[str]:
203 """
204 Validate email configuration completeness.
205
206 Returns:
207 List of validation error messages (empty if valid)
208 """

Calls

no outgoing calls