# Share notifications for administrators

A user who makes a share can ask the server for an email when the share's visitors download from it, or upload into it: the row **Notify me** of the share window, per share, with addresses of their choice. How users see it: [Share notifications](Web-Share-Notifications.md). This page is how to offer it, what the emails say, and what the server checks.

It is off until you turn it on.

## Notices or share events

There are two ways to mail about a share's use. They work side by side.

| | Share notifications (this page) | Share events |
|---|---|---|
| Who sets it up | the user, per share | you, per user or group: an event with the triggers **When a Share this user creates has this activity…** in [the event editor](Users-Events-Editor.md) |
| For which shares | the shares where the user ticked it | every share of that user |
| Where the mail goes | the addresses the user typed, or the user's own | the event's recipients |
| What else it can do | mail only | anything an event can do: a job, a plugin, a mail with the files |

A share event keeps firing for every share, notices or not.

## Turning it on

Three [customizations](Users-WebInterface-Customizations.md#share-window), on the [WebInterface](Users-WebInterface.md) tab of a user. Set them on `default` for everybody, or on a group's template or one user: they are [inherited](Users-Inheritance.md) like every customization.

| Customization | Key | Does |
|---|---|---|
| Share Window: Show "Notify me" of downloads and uploads | `shareWindowNotifyVisible` | `true`: the row is in the share window, in Custom Share and in Edit Share of Manage Shares. Without it, the server drops the notify fields of a new share and ignores them in an edit. |
| Share Window: "Notify me" of downloads ticked by default (also Quick Share) | `shareWindowNotifyDefault` | `true`: **Downloads** is ticked when the window opens, and **Quick Share** asks for download notices to the user's own address |
| Share Window: Notifications go only to the creator's own email | `shareWindowNotifyOwnEmailOnly` | `true`: no **Send to** field; the server sends to the account's address whatever the browser sends |

The user's own address is the account's **Email**, or the address from the directory (`ldap_mail`) when it is empty. It is never the **From** of the share mail, which the user types. A user without an address who leaves **Send to** empty gets "Error: Notifications need an email address. Enter one, or ask your administrator to add one to your account."

### Custom Share

The designer of a **Custom Share** button ([Forms and share options](Users-WebInterface-Forms.md#custom-share)) lists the row as **Notify me row (needs the user's "Show Notify me" setting)** in **Visible in Share window**. A hidden row still sends its defaults, as every hidden row of a custom share does: with `shareWindowNotifyDefault`, download notices to the user's own address.

A custom share button saved before CrushMFT had the row has no tick for it, so the row stays hidden there until you open the button and save it again.

## The emails

One email per visit and per kind: the server collects what the visitor did and sends when nothing happened for two minutes. **Downloads** covers downloads; **Uploads and changes** covers uploads, deletes, renames and new folders.

The text comes from two [email templates](Prefs-Email-Templates.md#names-the-server-looks-for), when you make them:

| Template name | For | Fields used |
|---|---|---|
| **Share Download Notify** | Downloads | **From** (empty: the server's sender), **CC**, **BCC**, **Subject**, **Body** |
| **Share Upload Notify** | Uploads and changes | the same |

Without them the server sends a short text of its own, from the sender in [SMTP](Prefs-General-SMTP.md):

```
Subject: Files were downloaded from your share Kp7wQ2xRtB

Files were downloaded from a share you made.

Share: Kp7wQ2xRtB
Ends: 12/15/2026 18:00
Visitor IP: 203.0.113.25

/price-list-2026.pdf (2.10 MB)
```

The upload text says "Files were uploaded to or changed in your share". In a template of your own, these hold:

| Variable | Is |
|---|---|
| `{user_name}` | the share's account name, as **Username** in Manage Shares |
| `{user_expire}` | when the share ends |
| `{user_ip}` | the visitor's address |
| `<LINE>…</LINE>` | repeated for each file; inside it `{the_file_path}` (the path with the name), `{the_file_size_formatted}`, `{the_file_size}`, `{the_file_end}` |

Leave the share's link out of a template: it carries the share's password. The built-in text shows the visitor's address and the file names; if you do not want that, write the two templates.

## What the server checks

The browser is not trusted with any of this. When a share is made or edited, the server:

- drops the fields unless the user has `shareWindowNotifyVisible`, and for internal shares;
- takes plain addresses only: letters, digits and `. _ + ' -` before the `@`, a dotted name after it, at most 10, separated by commas, semicolons or spaces. A name part (`Alex <alex@example.com>`), `{ } %` or a line break is refused with "Error: Notifications need plain email addresses, at most 10.";
- keeps only "true" and the checked address list in the share's record (`INFO.XML` of the [temporary account](Temp-Accounts.md)), never an event.

When a visitor opens the share, the server builds the notice events itself, from the record's three fields and the templates, and checks the addresses again. A record changed by hand to an address that is not plain sends nothing, with this line in the server log: "Share Kp7wQ2xRtB: activity notices skipped, the share has no valid addresses."

An edit in Manage Shares that carries no notify fields (a browser from before, or a user without the option) leaves the share's notices as they are.

## The admin Shares app and the API

| Where | What it does with the notices |
|---|---|
| the **Shares** app of the admin pages ([Temp accounts](Temp-Accounts.md)) | does not show them, and keeps them through **Save**. A save checks them like any other change, and a share record holding an address that is not plain is refused. |
| [the API](API-Shares.md): `POST /me/shares`, `PATCH /me/shares/{id}` | a user's own shares take `notify`: `{"downloads": true, "uploads": false, "to": ["alex@example.com"]}`, with the same rules as the share window; `to` left out is the account's address. An update sends all three, so `false` and `false` turns the notices off. |
| the API: `PATCH /shares/{id}` | an administrator changes any share's `notify`, with or without `expires`; `to` is required when a box is on |
| the API: `GET /me/shares`, `GET /shares` | answer each share's `notify` |

A refused `notify` is answered with 422 and the field: `notify.to` ("format", "required"), `notify.downloads` or `notify.uploads` ("type"), `notify` ("not_offered" for an account without the option, "external_only" with `usernames`).

## Logs

Each email is in the log of the kind `EVENT` as `Event:EMAIL ShareNotifyDownload:<share>` or `ShareNotifyUpload:<share>`, with its recipients. A mail that fails is logged there too, like every event mail.

## Things to know

- **Events must be in the license.** The notices are sent as events; every edition that has sharing links has events.
- **In a cluster** a change made in Manage Shares is replicated with the shares ([Replication](Replication.md)); a server of an older build ignores the notify fields of it.
- **Shares made by a job** have no notices.
- **The owner's own visit** through the link counts like anybody's.
