# Set how an application's end user notices are sent

> Set how an application's end user notices are sent: CustomDomain™ API reference in the applications group. Covers parameters, request body and responses.

Source: https://docs.customdomain.ai/docs/api-reference/applications/putEmailSender

## `PUT https://api.customdomain.ai/v1/applications/{id}/email-sender`

Replaces the setting. `mode` is `default` (the CustomDomain™ sender), `smtp` (the platform's own mail server, with the notice's From taken from `from_address` and `from_name`) or `none` (nothing is sent; use the `connection.records_outdated` webhook instead). With `smtp`, the host must be a public address, the port one of 25, 465, 587 or 2525, and TLS is always on: `implicit` on 465, `starttls` on the others. Plain text is not offered. The password is sealed at rest; leave `smtp_password` out to keep the stored one. A change of server, login or sender clears `verified_at`. A mail failure at send time falls back to the default sender for that message and is recorded in `last_error`. Requires `app:write`.

### Authentication

`apiKey`, `managementKey`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mode` | `default`, `smtp`, `none` | yes |  |
| `smtp_host` | string | no | A public host name or address. Private, loopback, link-local and metadata addresses are refused. |
| `smtp_port` | `25`, `465`, `587`, `2525` | no |  |
| `smtp_username` | string | no |  |
| `smtp_password` | string | no | Write only. Omit to keep the stored password. |
| `tls` | `implicit`, `starttls` | no | implicit on port 465, starttls on the others. Defaults to starttls. |
| `from_address` | string | no | A plain address such as hello@example.com. Required for smtp. |
| `from_name` | string | no |  |
| `reply_to` | string | no |  |

### Responses

| Status | Description |
| --- | --- |
| `200` | Saved. |
| `400` | Error envelope: {code, title, details, request_id}. |
| `401` | Error envelope: {code, title, details, request_id}. |
| `403` | Error envelope: {code, title, details, request_id}. |
| `404` | Error envelope: {code, title, details, request_id}. |
| `503` | Error envelope: {code, title, details, request_id}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `application_id` | string | yes |  |
| `mode` | `default`, `smtp`, `none` | yes |  |
| `smtp_host` | string | yes |  |
| `smtp_port` | integer | yes |  |
| `smtp_username` | string | yes |  |
| `password_set` | boolean | yes | Whether a password is stored. The password itself is never returned. |
| `tls` | `implicit`, `starttls` | yes |  |
| `from_address` | string | yes |  |
| `from_name` | string | yes |  |
| `reply_to` | string | yes |  |
| `verified_at` | string or null | yes |  |
| `last_error` | string | yes | The last failure, with no secret in it. Empty after a success. |
| `last_error_at` | string or null | yes |  |
| `updated_at` | string or null | no |  |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
