sendkit / sendkit-laravel
SendKit integration for Laravel
1.0.10
2026-03-12 01:23 UTC
Requires
- php: ^8.2
- illuminate/support: ^11.0|^12.0
- sendkit/sendkit-php: ^1.0
- symfony/mailer: ^7.0
Requires (Dev)
- orchestra/testbench: ^10.0
- pestphp/pest: ^3.0
README
Official Laravel integration for SendKit. Adds a sendkit mail transport and webhook handling.
Installation
composer require sendkit/sendkit-laravel
Configuration
Add your API key to .env:
MAIL_MAILER=sendkit SENDKIT_API_KEY=your-api-key
Optionally publish the config file:
php artisan vendor:publish --tag=sendkit-config
Usage
Sending Emails
Use Laravel's standard mail system — it just works:
Mail::to('recipient@example.com')->send(new WelcomeEmail());
Using the SDK Directly
use SendKit\Laravel\Facades\SendKit; $response = SendKit::emails()->send([ 'from' => 'you@example.com', 'to' => 'recipient@example.com', 'subject' => 'Hello', 'html' => '<h1>Welcome!</h1>', ]);
Validating an Email
use SendKit\Laravel\Facades\SendKit; $result = SendKit::validateEmail('recipient@example.com'); $result['is_valid']; // true or false $result['should_block']; // true if the email should be blocked $result['block_reason']; // reason for blocking, or null $result['evaluations']; // detailed evaluation results
The evaluations array contains:
has_valid_syntax— whether the email has valid syntaxhas_valid_dns— whether the domain has valid DNS recordsmailbox_exists— whether the mailbox existsis_role_address— whether it's a role address (e.g. info@, admin@)is_disposable— whether it's a disposable emailis_random_input— whether it appears to be random input
Note: Each validation costs credits. A
SendKitExceptionwith status 402 is thrown when credits are insufficient.
Webhooks
Webhook handling is auto-registered at POST /webhook/sendkit.
Setup
Add your webhook secret to .env:
SENDKIT_WEBHOOK_SECRET=your-webhook-secret
Listening for Events
use SendKit\Laravel\Events\EmailDelivered; Event::listen(EmailDelivered::class, function ($event) { // $event->payload contains the webhook data });
Available Events
EmailSent—email.sentEmailDelivered—email.deliveredEmailBounced—email.bouncedEmailComplained—email.complainedEmailOpened—email.openedEmailClicked—email.clickedEmailFailed—email.failedEmailDeliveryDelayed—email.delivery_delayed