API: Email
Manage email accounts and verify connections.
List Accounts
GET
/api/email-accountsList all email accounts (passwords masked)
Auth: Session
Add Account
POST
/api/email-accountsAdd a new email account
Auth: Session
| Parameter | Type | Description |
|---|---|---|
| string | Email address(required) | |
| smtpPass | string | SMTP password (encrypted at rest)(required) |
| provider | string | gmail, outlook, yahoo, or smtp (default) |
| smtpHost | string | SMTP host (auto from provider) |
| smtpPort | number | SMTP port (auto from provider) |
| smtpUser | string | SMTP user (defaults to email) |
| imapHost | string | IMAP host |
| imapPort | number | IMAP port |
| imapUser | string | IMAP user |
| imapPass | string | IMAP password |
Test Connection
POST
/api/email-accounts/testVerify SMTP connection (does not send email)
Auth: None
Request
{ "accountId": "clx..." }Response
{ "success": true, "message": "SMTP connection verified successfully" }Send Test Email
POST
/api/email-accounts/send-testSend a test email to verify full pipeline
Auth: None
Request
{ "accountId": "clx...", "toEmail": "you@example.com" }IMAP Auto-Detect
POST
/api/email-accounts/imap-detectDetect IMAP host/port from email domain
Auth: None
Request
{ "email": "user@gmail.com" }Response
{ "imapHost": "imap.gmail.com", "imapPort": 993, "reachable": true, "source": "known-provider" }