sendwax / laravel
Send transactional and marketing email through the Sendwax API from Laravel — a drop-in mail transport.
Requires
- php: ^8.2
- illuminate/mail: ^10.0 || ^11.0 || ^12.0 || ^13.0
- illuminate/support: ^10.0 || ^11.0 || ^12.0 || ^13.0
- symfony/http-client: ^6.4 || ^7.0 || ^8.0
- symfony/mailer: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^10.0 || ^11.0
README
Send transactional and marketing email through the Sendwax API
from any Laravel app. It registers a sendwax mail transport, so your existing
Mailables and Notifications keep working — you just point the mailer at Sendwax.
Requirements
- PHP 8.2+
- Laravel 10, 11, 12, or 13
- A Sendwax account with a verified sending domain and an API key (
esk_live_…)
Install
composer require sendwax/laravel
The service provider is auto-discovered. Then set two values in your .env:
MAIL_MAILER=sendwax
SENDWAX_KEY=esk_live_your_key_here
That's it. Every Mail::to(...)->send(...) and notification now goes through Sendwax.
Your
Fromaddress must be on a domain you have added and verified in Sendwax (the same domain, or a subdomain of it). Otherwise the API rejects the send withinvalid_from.
Sender name
The From display name is carried through automatically:
Mail::to($user)->send(new OrderShipped($order)); // From: "Acme Store <hello@acme.com>"
Set your default in config/mail.php (from.name / from.address) as usual.
Transactional vs. marketing
Sendwax classifies every message as transactional or marketing. Marketing mail can be blocked by a recipient's marketing opt-out and carries a one-click unsubscribe; transactional mail always sends. The type is chosen like this, in order:
- An explicit
X-Sendwax-Typeheader on the message (transactionalormarketing). - Otherwise, any message carrying a
List-Unsubscribeheader is treated as marketing. - Otherwise, the
sendwax.default_typeconfig value (default:transactional).
To force a type on a specific message:
use Illuminate\Mail\Mailables\Headers;
public function headers(): Headers
{
return new Headers(text: ['X-Sendwax-Type' => 'marketing']);
}
Reply-To, HTML, and text
Reply-To, HTML bodies, and plain-text bodies are all forwarded. Cc/Bcc are not
supported by the Sendwax API — a message with several To recipients is delivered
as one API call per recipient.
Idempotency
Each send includes an idempotency key derived from the message's Message-ID, so a
retried delivery (a request timeout, a queued job retry) will not send a duplicate.
Configuration
Publish the config file to change advanced settings:
php artisan vendor:publish --tag=sendwax-config
| Key | Env | Default |
|---|---|---|
sendwax.key | SENDWAX_KEY | — |
sendwax.endpoint | SENDWAX_ENDPOINT | https://sendwax.com |
sendwax.default_type | SENDWAX_DEFAULT_TYPE | transactional |
License
MIT.