Skip to main content

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)
Usage

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

FieldDescription
hostThe hostname or IP of the server.
portThe port number to connect to.
encryptionOne of Ssl, StartTls, or None.

OAuth2 Configuration (Optional)

FieldDescription
issuerThe OpenID issuer URL.
scopeScopes required for OAuth authorization.
auth_urlURL for authorization requests.
token_urlURL 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.