Docs
From zero to first campaign.
The essentials to install, configure, send, and integrate. Deep reference lives in the
GitHub README.
Overview
Newsletter is a complete newsletter management system for Laravel, built with Filament.
Manage subscribers, campaigns, HTML templates, scheduled sending, and full tracking from a modern admin
panel.
It ships with a Sanctum REST API (OpenAPI docs included) and an MCP server so AI agents can operate on the
same data as your team.
Requirements
- PHP
8.3+
- Laravel
13
- Filament
5
- Database SQLite, MySQL, or PostgreSQL
- Queue database, Redis, or similar
- Node for Vite asset builds
Installation
git clone https://github.com/andreapollastri/newsletter.git
cd newsletter
composer run setup
Then create an admin user and start the queue worker:
php artisan make:filament-user
./start-worker.sh
Optional sample data: php artisan newsletter:seed-data
(default credentials after seeding: admin@newsletter.test / password).
Generate OpenAPI docs with php artisan l5-swagger:generate.
Configuration
Mail
Configure SMTP in .env:
MAIL_MAILER=smtp
MAIL_HOST=your-smtp-host.com
MAIL_PORT=587
MAIL_USERNAME=your-username
MAIL_PASSWORD=your-password
MAIL_FROM_ADDRESS="newsletter@yourdomain.com"
MAIL_FROM_NAME="${APP_NAME}"
Rate limiting
Rolling windows in cache. Set a value to 0 to disable that cap.
| Variable |
Window |
Default |
NEWSLETTER_RATE_LIMIT_PER_MINUTE |
~1 min |
0 |
NEWSLETTER_RATE_LIMIT_PER_HOUR |
~1 h |
0 |
NEWSLETTER_RATE_LIMIT_PER_DAY |
~24 h |
0 |
NEWSLETTER_TRACKING_ENABLED |
— |
true |
Inspect live counters with php artisan newsletter:rate-limits.
Keep the worker --timeout a few seconds below your queue retry_after.
IMAP bounce detection (optional)
composer require webklex/laravel-imap
NEWSLETTER_IMAP_ENABLED=true
NEWSLETTER_IMAP_HOST=imap.yourdomain.com
NEWSLETTER_IMAP_PORT=993
NEWSLETTER_IMAP_USERNAME=your-username
NEWSLETTER_IMAP_PASSWORD=your-password
NEWSLETTER_IMAP_ENCRYPTION=ssl
NEWSLETTER_IMAP_FOLDER=INBOX
Roles
Every user has exactly one role.
| Role |
Access |
| Editor |
Create and manage draft messages inside existing campaigns. |
| Manager |
Campaigns, subscribers, tags, templates, all message states, and reports. |
| Administrator |
Everything a Manager can do, plus users and API token management. |
Sending
Immediate
- Open Newsletter → Messages
- Create or select a message
- Set status to Ready
- Click Send Now — the queue worker delivers
Scheduled
Set Scheduled Date on a message. The scheduler picks it up when due
(newsletter:send-scheduled every minute).
Testing tags
Mark tags as testing in Filament. Messages that target only testing tags are excluded from
production statistics
and cleaned up after the send — so you can dry-run the pipeline safely.
REST API
Authenticate with a Sanctum personal access token that has the api ability.
Create tokens from the admin user menu → API tokens.
Authorization: Bearer <your-token>
Resources under /api: user, newsletter report, tags, subscribers, templates, campaigns, and
messages.
Interactive OpenAPI UI: /api/documentation.
MCP server
Endpoint: /mcp/newsletter.
Authenticate with a Sanctum token that has the mcp ability.
Tools
list-campaigns
newsletter-report
send-history-analysis
subscriber-insights
generate-email-template-html
create-newsletter-message
Cursor / VS Code mcp.json
{
"mcpServers": {
"newsletter": {
"url": "https://your-domain.example/mcp/newsletter",
"headers": {
"Authorization": "Bearer YOUR_SANCTUM_TOKEN"
}
}
}
}
Debug locally with php artisan mcp:inspector mcp/newsletter.
Scheduler & commands
Add the Laravel scheduler to crontab:
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
| Task |
Schedule |
newsletter:send-scheduled |
Every minute |
newsletter:process-pending |
Every 5 minutes |
newsletter:process-bounces |
Every 15 minutes |
backup:run / backup:clean |
Daily |
Public routes: /subscribe, double opt-in confirm, and unsubscribe flows.
Deploy
Deploy on any Ubuntu VPS with
cipi.sh
— dedicated Linux user, PHP-FPM pool, zero-downtime deploys, SSL, and queue workers.
wget -O - https://cipi.sh/setup.sh | bash
Source and issues:
github.com/andreapollastri/newsletter
· MIT License · v2.1