Email reports
Every workspace owner/admin (streamers, community and server owners) and every advertiser gets a scheduled email report. The default is weekly; each user can switch to monthly or off.
| Workspace report | Advertiser report | |
|---|---|---|
| Who | owners and admins of each active workspace (one email per workspace) | every advertiser user of a sponsor (one email per sponsor); agency members also get one consolidated agency report (emails/report-agency.php) |
| What | revenue and orders (with change vs. previous period), subscribers (new / canceled / active), streams (count, hours, peak viewers, by platform), new members and followers, posts published, automation runs, players (unique, sessions, peak online), sponsorship earnings, refunds, top products | impressions (total, verified live, viewer impressions, on-screen time, change vs. previous period), link clicks and QR scans, conversions and attributed value, estimated CPM spend, budget remaining, per-campaign rows, top creators, items awaiting workspace approval |
| Template | resources/views/emails/report-workspace.php | resources/views/emails/report-advertiser.php |
| Change frequency | /dashboard/account → Email reports | advertiser portal overview → Email reports |
| Send now | /dashboard/analytics → Email me last week's report (admin+) | portal overview → Email me last week's report |
Schedule. The scheduler task reports.run runs hourly. Weekly reports cover the previous Monday–Sunday and go out on Monday from REPORTS_SEND_HOUR_UTC (default 08:00 UTC); monthly reports cover the previous calendar month and go out on the 1st. report_sends is unique per (user, kind, workspace/sponsor, period), so a report is never sent twice for the same period no matter how often the worker ticks. Manual "send now" uses a separate manual trigger and never blocks the scheduled one. Failures are stored on the row with the error.
Sender. Mail goes through the configured EmailProvider from EMAIL_FROM ([email protected]). With EMAIL_PROVIDER=smtp the client connects to SMTP_HOST:SMTP_PORT (465 = implicit SSL/TLS, 587 = STARTTLS) and authenticates with SMTP_USER / SMTP_PASS. Until SMTP_USER and SMTP_PASS are set, mail is written to storage/logs/mail.log instead — nothing is silently lost, and nothing is silently pretended either. The test suite always uses the log provider.
Unsubscribe. Every report carries a one-click link /reports/unsubscribe/{user}/{token} (HMAC of the user id with SESSION_SECRET) that sets the frequency to off without signing in, plus a link to the settings page.
Quiet periods still produce a short report with a hint on what to connect; the numbers are computed from the workspace's own tables through TenantScope, so one workspace never sees another's data (tests/ReportsTest.php).