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.
- Host
- smtp.usenotix.dev
- Port
- 465 or 587
- Username
- notix
- Password
- Your Notix API key
Send an email from Laravel.
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.
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.
'notix' => [
'key' => env('NOTIX_API_KEY'),
'webhook_secret' => env('NOTIX_WEBHOOK_SECRET'),
],
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.
MAIL_MAILER=smtp
MAIL_HOST=smtp.usenotix.dev
MAIL_PORT=465
MAIL_USERNAME=notix
MAIL_PASSWORD=notix_xxxxxxxxxxxx
MAIL_ENCRYPTION=ssl
Questions, answered.
Facade or SMTP mailer?
How do I pass an idempotency key from Laravel?
Why is my send refused with a from-address error?
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.