> ## Documentation Index
> Fetch the complete documentation index at: https://docs.commentify.pro/llms.txt
> Use this file to discover all available pages before exploring further.

# Email notifications and subscriptions

> Reply, mention, and thread-subscription mail, signed unsubscribe, and moderator digests.

Turn on mail under `core`:

```php theme={null}
'core' => [
    'enable_notifications' => true,
    'notification_channels' => ['mail'],
],
```

Core also supports `database` and `broadcast`. Pro wires **mail** listeners for the production loop below. Notifications only send for **approved** comments.

## What Pro sends

| Notification              | Who                                                            |
| ------------------------- | -------------------------------------------------------------- |
| Reply to a parent comment | Parent author (including **guest** parents via on-demand mail) |
| `@mention`                | Users whose `name` matches `@Name` (skips self-mentions)       |
| Thread subscription       | Everyone subscribed to that commentable except the author      |

Same-author replies (matching user id, or matching guest emails) are skipped.

## Subscribe on post

The create payload / composer can send `subscribe_to_replies: true`. Requires a non-empty email (account email or guest email) and `notifications.subscriptions_enabled` (default true).

Subscriptions live in `commentify_subscriptions` (unique per commentable + email) with a random token.

## Unsubscribe

Signed route:

```
GET /commentify/unsubscribe/{token}
```

Middleware: `web` + `signed`. Marks `subscribed = false` and shows a small Blade view. Build the URL with `SubscriptionManager::unsubscribeUrl()` — mail notifications already include it.

```php theme={null}
use Usamamuneerchaudhary\CommentifyPro\Support\SubscriptionManager;

app(SubscriptionManager::class)->unsubscribeUrl($subscription);
```

## Permalinks

Mail CTAs need a public URL. Implement `commentifyUrl()` on the commentable or `Commentify::resolveCommentUrlUsing()`. See [Usage](/usage). Links use `#comment-{id}`.

## Moderator digest

```bash theme={null}
php artisan commentify:digest-moderators
```

```env theme={null}
COMMENTIFY_MODERATORS=mods@example.com,lead@example.com
COMMENTIFY_DIGEST_INTERVAL=daily
```

`daily` (default) looks at the last day for new reports and spam denies, plus the **current** pending-comment count. `hourly` uses the last hour. `off` no-ops.

Nothing is sent if all three counts are zero. Schedule it in `routes/console.php`:

```php theme={null}
use Illuminate\Support\Facades\Schedule;

Schedule::command('commentify:digest-moderators')->dailyAt('08:00');
```

Configure `QUEUE_CONNECTION` and mailer as you would for any Laravel notification.
