Notix
Integrations

Notix in Laravel: the facade, the mailer and webhooks.

The PHP SDK ships a Laravel service provider and a Notix facade that Laravel discovers on install. Use the facade where you want the message id back or an idempotency key, and point the SMTP mailer at the relay so every Mailable and notification you already have sends through Notix too.

The send

Send an email from Laravel.

composer require usenotix/notix-php
use Notix\Laravel\Facades\Notix;

$email = Notix::emails()->send([
    'from' => 'Acme <receipts@acme.com>',
    'to' => $order->email,
    'subject' => 'Your receipt',
    'html' => view('emails.receipt', ['order' => $order])->render(),
], "order-{$order->id}-receipt");

$order->update(['receipt_email_id' => $email['emailId']]);

The from address must be on a domain you have verified in Notix. Step by step: the Laravel quickstart and the longer guide to sending email from Laravel.

Configure

The key in .env and services.php.

The provider reads services.notix.key first and falls back to the NOTIX_API_KEY environment variable. Add the webhook secret beside it so the same config holds both.

config/services.php
'notix' => [
    'key' => env('NOTIX_API_KEY'),
    'webhook_secret' => env('NOTIX_WEBHOOK_SECRET'),
],
SMTP relay

Or point the Laravel mailer at the relay.

The relay is smtp.usenotix.dev on port 465 (implicit TLS) or 587 (STARTTLS). The username is always notix and the password is your API key, so the Laravel mailer sends through Notix without new code. Mail sent this way gets the same suppression list, tracking and webhooks as the API.

.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.usenotix.dev
MAIL_PORT=465
MAIL_USERNAME=notix
MAIL_PASSWORD=notix_xxxxxxxxxxxx
MAIL_ENCRYPTION=ssl
FAQ

Questions, answered.

Facade or SMTP mailer?
Both can live in one app. The mailer sends your existing Mailables and notifications without code changes; the facade returns the message id and accepts an idempotency key, which suits receipts and codes that must never go twice.
How do I pass an idempotency key from Laravel?
As the second argument to send. The same key with the same body returns the original result; the same key with a different body throws NotUniqueException.
Why is my send refused with a from-address error?
The from address must be on a domain you have verified in Notix. Add the domain in the console, publish the DNS records it shows, and wait for verification; until then, sends from that domain are refused.

The free plan does not ask for a card.

Send your first email in five minutes.

Verify a domain, copy an API key, make one call. The free plan does not ask for a card.