Embeds
Set the SMTP server
Send scheduled email reports from your own mail server.
PUT
The setting is for your whole organization. Databrain signs in to the server first and saves the settings only if that works.
curl --request PUT https://api.usedatabrain.com/api/v2/data-app/smtp-settings \ --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "host": "smtp.example.com", "port": 587, "secure": true, "username": "reports@example.com", "password": "<password>", "fromAddress": "reports@example.com", "replyToAddress": "support@example.com" }'Auth
A service token. See Authentication.
ApiTokenheader
AuthorizationBearer <token>A service token or a data app API token.
Body
All fields are required. Unknown fields are refused.
The SMTP server. It must be a public address.
The port, for example 587 or 465
Use TLS. See below.
SMTP user.
SMTP password.
| Port | secure: true | secure: false |
|---|---|---|
| 465 | TLS from the start | TLS from the start |
| 25, 587, 2525 | STARTTLS, required | TLS only if the server offers it |
| Other | TLS from the start | TLS only if the server offers it |
The connection test waits up to 20 seconds.
Response
{ "data": { "success": true } }Errors
| Status | error.code | Why |
|---|---|---|
| 400 | INVALID_REQUEST_BODY | A field is missing or wrong, for example "fromAddress" must be a valid email. Or the host is a private address |
| 400 | INTERNAL_SERVER_ERROR | Databrain could not sign in to the server. The message says why. Nothing was saved |
| 500 | INTERNAL_SERVER_ERROR | The settings could not be saved |
For errors that every endpoint returns, see Authentication.
curl -X PUT 'https://api.usedatabrain.com/api/v2/data-app/smtp-settings' \ -H 'Content-Type: application/json' \ -d '{ "host": "smtp.example.com", "port": 587, "secure": true, "username": "reports@example.com", "password": "<password>", "fromAddress": "reports@example.com", "replyToAddress": "support@example.com"}'Example Response
{ "data": { "success": true }}