> For the complete documentation index, see [llms.txt](https://wiki.datadike.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.datadike.com/sonar/administration/settings/email-and-sms.md). Agents can also search and read this documentation through its [MCP server](https://wiki.datadike.com/~gitbook/mcp).

# Email and SMS notifications

Configure the mail server and the Twilio account SONAR uses to send alert notifications, add the default recipients, and test both with Save and Test Email and Save and Test SMS.

## What this is and when to use it

SONAR sends alert notifications by email through an SMTP server you provide, and by SMS through your own Twilio account. **Admin Center › Settings › Mail Server** and **Admin Center › Settings › SMS** hold the connection details and the default recipients.

Configure them before you rely on email or SMS alerts: until the mail server or the Twilio account is set, alerts appear on the dashboard only. The recipients here are the defaults. An alert template can name its own recipients, which then replace these for the devices that use that template.

## Before you start

* Your role needs **View Core Settings** to open **Settings**, and **Edit Core Settings** to save and to send tests (group **Settings** in **Admin Center › Roles**).
* For email: the SMTP host and port, and a username and password if the server requires authentication. The SMTP server must accept connections from SONAR; ask DataDike implementation support for the address SONAR sends from if your server filters by source.
* For SMS: a Twilio account with a sending number, its Account SID and its Auth Token.
* Recipient phone numbers in E.164 format, such as `+15555550100`.

## Steps

### Configure email

1. Open **Admin Center › Settings** and the **Mail Server** tab.
2. In **Email Alert Routing**, click **Add emails**, type an address in **Email** and click **Add**. Repeat for each recipient.
3. In **SMTP Settings**, fill in **From email** and, optionally, **From name**.
4. Fill in **Host** and **Port**.
5. If the server requires a login, tick **My Server Requires Authentication** and fill in **Username** and **Password**.
6. Click **Save and Test Email** to save and send a test message, or **Save Settings** to save only.
7. In **Confirm changes**, click **Save**.

### Configure SMS

1. Open **Admin Center › Settings** and the **SMS** tab.
2. In **SMS Alert Routing**, click **Add numbers**, type a number in **Number** and click **Add**. Repeat for each recipient.
3. In **Twilio Settings**, fill in **Twilio Number**, **Twilio Account SID** and **Twilio Auth Token**.
4. Click **Save and Test SMS** to save and send a test message, or **Save Settings** to save only.
5. In **Confirm changes**, click **Save**.

To remove a recipient, click its chip in **Recipients**, then save.

### Use them in alerts

Which alerts send email or SMS is decided by the alert template and by the **Email** and **Text** options of each check, task and device, see [Alerts and alert templates](https://wiki.datadike.com/sonar/administration/automation/alerts.md). In the alert template:

* **Email recipients** and **SMS recipients** replace the default recipients of this page for the devices using that template. Left empty, the defaults apply.
* **Email From address** replaces **From email** for that template's emails.

Informational and warning alerts notify only if **Informational Alerts** and **Warning Alerts** are ticked in **Admin Center › Settings › General**, see [General settings](https://wiki.datadike.com/sonar/administration/settings/general.md).

## What you should see

Recipients appear as chips in **Recipients**; with none, the card reads **No recipients**.

After **Save and Test Email**, the message **Email test ok!** confirms that the server accepted the message, and each default recipient receives a short test email. After **Save and Test SMS**, **SMS Test sent successfully!** confirms that Twilio accepted the messages.

With **My Server Requires Authentication** ticked, SONAR connects to the host, switches the connection to TLS (STARTTLS) and signs in. Without it, SONAR hands the message to the host as an unauthenticated relay. Use a port that matches: usually 587 with authentication, 25 for an internal relay.

## How to verify it worked

1. Click **Save and Test Email** and confirm that the test message reaches every address in **Recipients**, including the spam folder.
2. Click **Save and Test SMS** and confirm that every number receives the test SMS.
3. For a real notification, enable **Email** or **Text** on a check of a test device, make the check fail, and confirm the message arrives. The alert itself appears under **Alerts**.
4. In **Reports & Audits › Audits**, a **Modify Object** entry on **Core Settings** records the change, see [Audit trail](https://wiki.datadike.com/sonar/administration/audit/audit-trail.md).

## Common errors

| Symptom                                                                                   | Cause                                                                                                                                                                 | Fix                                                                                                               |
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **There needs to be at least one email recipient configured**                             | No recipient in **Recipients**, or **From email**, **Host**, **Port** (and **Username** and **Password** with authentication) are not all filled in                   | Add a recipient and complete the SMTP fields                                                                      |
| **Failed to send test email** with an authentication error                                | Wrong **Username** or **Password**, or the server does not allow this account to send                                                                                 | Check the account with the mail administrator                                                                     |
| **Failed to send test email** with a connection error or timeout                          | Wrong **Host** or **Port**, or the SMTP server does not accept connections from SONAR                                                                                 | Check the host and port; ask DataDike implementation support for the address SONAR sends from                     |
| The test works but mail lands in spam                                                     | **From email** is not authorised to send for its domain                                                                                                               | Use a sender address your mail domain authorises                                                                  |
| **All fields are required, including at least 1 recipient**                               | **Twilio Number**, **Twilio Account SID** or **Twilio Auth Token** is empty                                                                                           | Fill in the three Twilio fields                                                                                   |
| **No sms recipients found**                                                               | **Recipients** in **SMS Alert Routing** is empty                                                                                                                      | Add at least one number                                                                                           |
| **Failed to send test SMS** with a Twilio error                                           | The account, token or sending number is rejected, or a recipient number is not valid                                                                                  | Check the Twilio account and the number format                                                                    |
| **Invalid phone number**, **Invalid Account SID** or **Invalid Auth Token** under a field | The value does not match the expected format                                                                                                                          | See the field reference                                                                                           |
| Test messages arrive but alert messages do not                                            | The alert is informational or warning and that severity is not ticked in **Admin Center › Settings › General**, or the template or check does not enable email or SMS | Check both, see [Alerts and alert templates](https://wiki.datadike.com/sonar/administration/automation/alerts.md) |

## Field reference

### Mail Server

| Field                                 | What it does                                                                   | Accepted values                                  | Default                          |
| ------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------ | -------------------------------- |
| **Recipients** (Email Alert Routing)  | Default addresses for alert emails and for the test email                      | Valid email addresses, added with **Add emails** | None                             |
| **From email**                        | Sender address of the emails                                                   | A valid email address. Required                  | A placeholder address to replace |
| **From name**                         | Display name of the sender                                                     | Free text                                        | Empty                            |
| **Host**                              | SMTP server name or address                                                    | Host name or IP address                          | A placeholder to replace         |
| **Port**                              | SMTP port                                                                      | 1 to 65535                                       | 587                              |
| **My Server Requires Authentication** | Uses STARTTLS and signs in with the account below                              | On or off                                        | On                               |
| **Username**                          | SMTP account, shown when authentication is on                                  | Text                                             | A placeholder to replace         |
| **Password**                          | SMTP password, shown when authentication is on; the eye icon shows or hides it | Text                                             | —                                |

### SMS

| Field                              | What it does                                       | Accepted values                                        | Default |
| ---------------------------------- | -------------------------------------------------- | ------------------------------------------------------ | ------- |
| **Recipients** (SMS Alert Routing) | Default numbers for alert SMS and for the test SMS | Numbers in E.164 format, added with **Add numbers**    | None    |
| **Twilio Number**                  | Twilio number the SMS are sent from                | `+` followed by 7 to 15 digits, such as `+15555550100` | Empty   |
| **Twilio Account SID**             | Identifies the Twilio account                      | `AC` followed by 32 hexadecimal characters             | Empty   |
| **Twilio Auth Token**              | Authenticates SONAR to Twilio                      | 32 hexadecimal characters                              | Empty   |

Each SMS is sent once per recipient number.

## Related pages

* [Alerts and alert templates](https://wiki.datadike.com/sonar/administration/automation/alerts.md): which alerts notify, and per-template recipients
* [General settings](https://wiki.datadike.com/sonar/administration/settings/general.md): the severities that notify
* [Checks](https://wiki.datadike.com/sonar/administration/automation/checks.md): the **Email** and **Text** options of a check
* [Webhooks](https://wiki.datadike.com/sonar/administration/settings/webhooks.md): send alerts to another system instead of a mailbox
* [Audit trail](https://wiki.datadike.com/sonar/administration/audit/audit-trail.md): who changed these settings
