Mailer settings - configuration guide
A single guide to configure the mailer used for BREVO or SMTP providers
At a glance
- One configuration per tenant.
GET /v1/settings/mailer(getMailerSetting) returns the current configuration, includingauthType. Secrets are never returned.PUT /v1/settings/mailer(updateMailerSetting) replaces the whole configuration.PATCH /v1/settings/mailer(patchMailerSetting) updates a subset of fields. An omitted SMTPpasswordis preserved.- Supported providers: BREVO and SMTP. For SMTP, the authentication type is returned in read as
BASIC_AUTHorNONE; useBASIC_AUTHwhen the server expects credentials.
🟩 Read the current configuration
GET /v1/settings/mailer (getMailerSetting) returns the current mailer configuration, including the authentication type (configuration.authType) for SMTP.
Response — SMTP provider
{
"sender": "[email protected]",
"senderName": "Support Team",
"configuration": {
"provider": "SMTP",
"host": "smtp.example.com",
"port": 587,
"username": "smtp-user",
"authType": "BASIC_AUTH"
}
}configuration.authType is returned with one of the following values:
| Value | Meaning |
|---|---|
BASIC_AUTH | The SMTP server expects a username and a password. |
NONE | No authentication is used against the SMTP server. |
Note: Secrets are write-only: the SMTPpasswordand the BrevoapiKeyare never returned in read. Reading the configuration back after an update will not expose them. This is why an edit screen must treat an empty password input as "keep the current value" rather than "clear the password".
🟦 BREVO configuration
Minimum fields
sender- From emailsenderName- From display nameconfiguration.provider=BREVOconfiguration.apiKey- your Brevo API key
(Note: the current PUT contract also expects a root-level apiKey. Mirror the same value there.)
Request - PUT (full)
PUT /v1/settings/mailer
Content-Type: application/json
{
"sender": "[email protected]",
"senderName": "Djust Commerce",
"apiKey": "YOUR_BREVO_API_KEY",
"configuration": {
"provider": "BREVO",
"apiKey": "YOUR_BREVO_API_KEY"
}
}Request - PATCH (rotate key only)
PATCH /v1/settings/mailer
Content-Type: application/json
{
"configuration": {
"provider": "BREVO",
"apiKey": "NEW_BREVO_API_KEY"
}
}🟧 SMTP configuration
Minimum fields
sender- From emailsenderName- From display nameconfiguration.provider=SMTPconfiguration.host- Your SMTP server hostconfiguration.port- Your SMTP server portconfiguration.username- Your SMTP server login usernameconfiguration.password- Your SMTP server login passwordconfiguration.authType=BASIC_AUTH(currently supported mode)
Note: the PUT contract still requires a root-level apiKey, which is not used by SMTP. Provide a harmless placeholder.
Request - PUT (full)
PUT /v1/settings/mailer
Content-Type: application/json
{
"sender": "[email protected]",
"senderName": "Support Team",
"apiKey": "ignored-for-smtp",
"configuration": {
"provider": "SMTP",
"host": "smtp.example.com",
"port": 587,
"username": "smtp-user",
"password": "smtp-password",
"authType": "BASIC_AUTH"
}
}Request - PATCH (rotate password)
PATCH /v1/settings/mailer
Content-Type: application/json
{
"configuration": {
"provider": "SMTP",
"password": "new-smtp-password"
}
}
Tip: The stored SMTP password is preserved whenconfiguration.passwordis omitted from a PATCH request. You only need to send it to change it — updating other fields (host, port, username…) carries no risk of erasing the secret.
Request — PATCH (change the host, keep the password)
PATCH /v1/settings/mailer
Content-Type: application/json
{
"configuration": {
"provider": "SMTP",
"host": "smtp2.example.com",
"port": 587
}
}flowchart LR
%% Styles (Readme)
classDef create fill:#e8f1ff,stroke:#2f6feb,stroke-width:2px,color:#0b3d91;
classDef read fill:#ede9fe,stroke:#7c3aed,stroke-width:2px,color:#1e1b4b;
classDef update fill:#e0f7fa,stroke:#06b6d4,stroke-width:2px,color:#0c4a6e;
classDef decision fill:#fff4e5,stroke:#f59e0b,stroke-width:2px,color:#7a3e00;
classDef place fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#14532d;
classDef sys fill:#f2f4f7,stroke:#475569,stroke-width:2px,color:#111827;
A[🧾 PATCH /v1/settings/mailer<br>SMTP configuration] --> B{configuration.password<br>sent in the payload}
B -->|Yes| C[🔑 Password replaced<br>by the new value]
B -->|No| D[🔒 Stored password<br>kept unchanged]
C --> E[✅ Other SMTP fields updated]
D --> E
class A sys
class B decision
class C update
class D read
class E place
style A rx:8,ry:8
style C rx:8,ry:8
style D rx:8,ry:8
style E rx:8,ry:8
✅ Validation checklist
senderis a valid email andsenderNameis meaningful.- BREVO:
configuration.apiKeypresent (and mirrored to root apiKey for PUT). - SMTP: host, port, username, password, authType=BASIC_AUTH.
- Use PATCH to rotate secrets without resending the full object.
- To update SMTP fields without changing the password, simply omit
configuration.password— the stored value is kept.
🧯 Troubleshooting
| Symptom | Likely cause | What to check |
|---|---|---|
403 Forbidden | Wrong scope/headers | Use dj-client=OPERATOR with a valid admin API key. |
400 Bad Request on PUT | Missing required fields | Provide all required fields for the chosen provider. |
| SMTP send fails | Wrong host/creds or TLS policy | Verify server, port, username/password and allowed auth. |
| Brevo errors | Invalid/expired API key | Rotate configuration.apiKey via PATCH. |
If Djust configures this for you: share the sender, senderName, and either your Brevo API key or SMTP details (host, port, username, password, auth type). Remember: one mailer config per tenant.
Updated 21 days ago

