# IRPCEvents.SendCustomNotification

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Events and notifications](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCEvents/index.md)

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

Badges: `Vault API / standard` `write` `session` `returns metadata structure version`

Sends an e-mail with the given subject and body to users, groups and e-mail addresses.

- **Service:** [Events and notifications](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCEvents/index.md) `MFiles.IRPCEvents`
- **gRPC method:** `/MFiles.IRPCEvents/SendCustomNotification`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/send-custom-notification`
- **Request:** [`SendCustomNotificationRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCEvents/SendCustomNotification/index.md#request)
- **Response:** [`SendCustomNotificationResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCEvents/SendCustomNotification/index.md#response)
- **Book and level:** Vault API, standard
- **Kind:** write
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** no
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

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

## Remarks

- Requires a vault session of a user. Adding `external_recipients`, or setting
  `send_with_server_email_identity`, also requires the server right `send_server_messages`
  ([ServerAccess](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ServerAccess/index.md)); without it the call fails with "Access
  denied.".
- Groups are expanded to their members. Each user and each external address gets its own
  e-mail. Messages are queued when the call commits.
- The call succeeds and sends nothing when notifications are disabled on the server or in the
  vault, or when the vault does not allow custom notifications.
- Sent as the caller's e-mail address, which must then be valid; or, with
  `send_with_server_email_identity`, from the server's notification address with the caller's
  address as reply-to.
- An external address that is not a valid e-mail address fails the whole call.

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

## Request: SendCustomNotificationRequest

> 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 |
|---|---|---|
| `uugidarr[]` | repeated [`UserOrUserGroupID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.UserOrUserGroupID/index.md) | The recipient users and user groups. |
| `uugidarr[].type` | [`UserType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.UserType/index.md) | User type. Values: `USER_TYPE_UNKNOWN` (0), `USER_TYPE_USER` (1), `USER_TYPE_USER_GROUP` (2), `USER_TYPE_WORKFLOW_STATE_PSEUDO_USER` (3), `USER_TYPE_PROPERTY_BASED_PSEUDO_USER` (4). |
| `uugidarr[].id` | `int32` | User or user group. |
| `include_substitute_users` | `bool` | True to also send to the substitute users of the recipient users. |
| `external_recipients[]` | repeated `string` | Additional recipients as e-mail addresses, for example `name@example.com`. Requires the server right `send_server_messages`. |
| `send_with_server_email_identity` | `bool` | True to send from the server's notification address instead of the caller's own address. Requires the server right `send_server_messages`. |
| `subject` | `string` | The subject of the e-mail. |
| `body` | `string` | The body of the e-mail. |

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

## Response: SendCustomNotificationResponse

No fields.
