# IRPCServerAdmin.SetNotificationSettings

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md) > [Server administration](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCServerAdmin/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCServerAdmin/SetNotificationSettings/

Badges: `Administration API / specialized` `admin` `session` `idempotent`

Sets the server's notification settings: whether notifications are on, the daily digest time,
and the SMTP or OAuth 2.0 mail settings used to send them.

- **Service:** [Server administration](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCServerAdmin/index.md) `MFiles.IRPCServerAdmin`
- **gRPC method:** `/MFiles.IRPCServerAdmin/SetNotificationSettings`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/set-notification-settings`
- **Request:** [`SetNotificationSettingsRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCServerAdmin/SetNotificationSettings/index.md#request)
- **Response:** [`SetNotificationSettingsResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCServerAdmin/SetNotificationSettings/index.md#response)
- **Book and level:** Administration API, specialized
- **Kind:** admin
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** yes
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Requires the system administrator server role (server right `edit_server_properties`).
- Replaces all settings; read them first with
  [GetNotificationSettings](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCServerAdmin/GetNotificationSettings/index.md).
- Validation (each fails with "The parameter is incorrect." and a description): the digest hour
  must be 0-23 and the minute 0-59; with `MAIL_SOURCE_AUTH_TYPE_BASIC`, `smtp_server` and a
  non-zero `smtp_port` are required; with `MAIL_SOURCE_AUTH_TYPE_OAUTH2`, `oauth2_settings` is
  required.
- `mail_source_auth_type` `MAIL_SOURCE_AUTH_TYPE_NONE` without `oauth2_settings` is treated as
  basic SMTP authentication (for older clients); with `oauth2_settings` it fails.

<a id="request"></a>

## Request: SetNotificationSettingsRequest

A structure that specifies the request type for the SetNotificationSettings method.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `notifications_enabled` | `bool` | Tells if the notifications are enabled. |
| `digest_notification_message_hour_utc` | `uint32` | The hour (UTC, 0-23) when the daily digest messages are sent. |
| `digest_notification_message_minute_utc` | `uint32` | The minute (0-59) when the daily digest messages are sent. |
| `smtp_server` | `string` | The SMTP server for delivering notifications. Can be an IP address or a DNS name. |
| `smtp_connection_parameters` | [`SMTPConnectionParameters`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.SMTPConnectionParameters/index.md) | Parameters for SMTP connection. Values: `SMTPCONNECTION_PARAMETERS_STANDARD` (0), `SMTPCONNECTION_PARAMETERS_AUTHENTICATION_PLAIN` (1), `SMTPCONNECTION_PARAMETERS_AUTHENTICATION_LOGIN` (2), `SMTPCONNECTION_PARAMETERS_AUTHENTICATION_CRAM_MD5` (4). |
| `smtp_auth_username` | `string` | User name for SMTP authentication. |
| `smtp_auth_password_enc` | `string` | The SMTP password, encrypted with the server's public key ([GetPublicKey](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCLogin/GetPublicKey/index.md)). Append five padding characters to the password before encrypting: the server removes the last five characters after decrypting. Used only when `smtp_password_set` is true. |
| `smtp_password_set` | `bool` | True to set the SMTP password from `smtp_auth_password_enc`. |
| `smtp_mail_from_address` | `string` | The address of the sender when sending notifications. |
| `smtp_mail_from_display_name` | `string` | The display name of the sender when sending notifications. |
| `smtp_port` | `uint32` | The port the SMTP server is listening. |
| `mail_source_auth_type` | [`MailSourceAuthType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.MailSourceAuthType/index.md) | `MAIL_SOURCE_AUTH_TYPE_BASIC` for SMTP or `MAIL_SOURCE_AUTH_TYPE_OAUTH2` for OAuth 2.0 (then set `oauth2_settings`). Values: `MAIL_SOURCE_AUTH_TYPE_NONE` (0), `MAIL_SOURCE_AUTH_TYPE_BASIC` (1), `MAIL_SOURCE_AUTH_TYPE_OAUTH2` (2). |
| `oauth2_settings` | [`Oauth2NotificationSettings`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Oauth2NotificationSettings/index.md) | OAuth2 specific data. |
| `oauth2_settings.mail_source` | [`MailSourceOauth2`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.MailSourceOauth2/index.md) | OAuth2 specific data. |
| `oauth2_settings.mail_source.type` | [`MailSourceOauth2Type`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.MailSourceOauth2Type/index.md) | OAuth2 service to use. Values: `MAIL_SOURCE_OAUTH2_TYPE_NONE` (0), `MAIL_SOURCE_OAUTH2_TYPE_MICROSOFT_OAUTH2` (1), `MAIL_SOURCE_OAUTH2_TYPE_GOOGLE_OAUTH2` (2). |
| `oauth2_settings.mail_source.status` | [`MailSourceOauth2Status`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.MailSourceOauth2Status/index.md) | Authentication status. Values: `MAIL_SOURCE_OAUTH2_STATUS_NONE` (0), `MAIL_SOURCE_OAUTH2_STATUS_ERROR` (1), `MAIL_SOURCE_OAUTH2_STATUS_AUTHENTICATED` (2), `MAIL_SOURCE_OAUTH2_STATUS_EXPIRED` (3). |
| `oauth2_settings.mail_source.user_info` | `string` | Information about the authenticated user (account name etc.). |
| `oauth2_settings.mail_source.configuration` | `string` | Configuration for authentication in JSON format as name-value pairs. Use names as defined in OAuth2 standard. |
| `oauth2_settings.mail_source.token_cache` | `bytes` | Token cache. For Google OAuth2 this is in JSON format. For MSAL this is in its internal binary format. |
| `oauth2_settings.mail_source.proxy_address` | `string` | Proxy address if used. |
| `oauth2_settings.mail_from_address` | `string` | The address of the sender when sending notifications with OAuth2. |
| `oauth2_settings.authentication_timeout` | `uint32` | Maximum time in seconds to wait for the OAuth2 authentication to take place. |
| `oauth2_settings.mail_service_timeout` | `uint32` | Maximum time seconds to wait for the OAuth2 mail service request to be responded. |

<a id="response"></a>

## Response: SetNotificationSettingsResponse

No fields.

<a id="related"></a>

## Related methods

- [GetNotificationSettings](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCServerAdmin/GetNotificationSettings/index.md): Gets the server's notification settings and mail-sending configuration (without the SMTP password).
