wyxos / laravel-mail-provision
Provision SparkPost sending/tracking domains and Cloudflare DNS records, and optionally configure SparkPost SMTP env settings.
v0.1.3
2026-11-20 18:21 UTC
Requires
- php: ^8.2|^8.3|^8.4
- illuminate/console: ^11.0|^12.0|^13.0
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0|^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Provision SparkPost sending/tracking domains and Cloudflare DNS records, and optionally configure SparkPost SMTP mail settings in your .env.
Install
composer require wyxos/laravel-mail-provision
Supports Laravel 11, 12, and 13.
Required Env
CLOUDFLARE_API_TOKEN- Either
CLOUDFLARE_ZONE_IDorCLOUDFLARE_ZONE_NAME(otherwise it will infer a zone name from the last 2 labels of your domain) - SparkPost provisioning API key (one of):
SPARKPOST_PROVISIONING_KEYSPARKPOST_API_KEYMAIL_PASSWORD
SPARKPOST_SMTP_KEYis optional. Set it to a send-only key when writing SMTP settings. If omitted, the provisioning key is used as the SMTP password for compatibility.
Usage
Provision using APP_DOMAIN (or APP_URL host) when the domain argument is omitted:
php artisan mail:provision-domain
Provision an explicit domain:
php artisan mail:provision-domain nudge.example.com
After DNS and the SparkPost domain verify successfully, the command updates your env file with SparkPost SMTP settings:
MAIL_MAILER=smtp MAIL_SCHEME=smtp MAIL_URL=null MAIL_HOST=smtp.sparkpostmail.com MAIL_PORT=587 MAIL_USERNAME=SMTP_Injection MAIL_PASSWORD=<SMTP_KEY> MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=no-reply@<your-domain> MAIL_FROM_NAME="${APP_NAME}"
Options:
--api-key=Override the SparkPost provisioning API key--no-envSkip writing env mail settings--env-file=Override env file path to update--preserve-senderKeep existingAPP_DOMAIN,MAIL_FROM_ADDRESS, andMAIL_FROM_NAMEsettings--skip-trackingLeave tracking domains and the sending domain's tracking association unchanged--tracking=Override tracking domain (defaults tosp.<domain>)--skip-spf,--skip-dmarcSkip those TXT records
Use --skip-spf --skip-dmarc when the zone already has SPF and DMARC policies to keep.
Notes
- Packagist versions should be managed via git tags (e.g. v0.1.1).