AutoConfig API
The AutoConfig API in RustMailer helps users automatically retrieve IMAP, SMTP, and OAuth2 configurations based on an email domain.
This feature is primarily used when registering a new email account in RustMailer. By providing an email address, RustMailer attempts to discover the appropriate mail server settings, simplifying the setup process.
Endpoint
- Path:
/api/v1/autoconfig/:email_address
- Method:
GET
- Operation ID:
autoconfig
- Authorization: Bearer token required (if access token is enabled)
The email_address
only needs to contain a valid domain (e.g. someone@gmail.com
). The system will extract the domain and look up the mail configuration.
Example
CURL Request
curl -X GET https://your-domain.com/api/v1/autoconfig/example@gmail.com \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Response Structure
The API returns a MailServerConfig
object in JSON format:
{
"imap": {
"host": "imap.example.com",
"port": 993,
"encryption": "Ssl"
},
"smtp": {
"host": "smtp.example.com",
"port": 587,
"encryption": "StartTls"
},
"oauth2": {
"issuer": "https://accounts.example.com",
"scope": ["https://mail.example.com"],
"auth_url": "https://accounts.example.com/auth",
"token_url": "https://accounts.example.com/token"
}
}
IMAP/SMTP Configuration
Field | Description |
---|---|
host | The hostname or IP of the server. |
port | The port number to connect to. |
encryption | One of Ssl , StartTls , or None . |
OAuth2 Configuration (Optional)
Field | Description |
---|---|
issuer | The OpenID issuer URL. |
scope | Scopes required for OAuth authorization. |
auth_url | URL for authorization requests. |
token_url | URL for token requests. |
Use Case
This API is typically called from the account registration page. After entering the email address, the frontend can fetch and auto-fill the IMAP/SMTP configuration fields.
This functionality is available via both OpenAPI and gRPC interfaces.