Framework Integration

Laravel Transactional Email API & SMTP Transport

Send transactional emails from Laravel applications with sub-50ms dispatch, 100% DKIM signing, and parcel delivery receipts.

Drop-In Symfony & Laravel Mail Support

Because Laravel uses Symfony Mailer under the hood, SendPorter functions as an immediate drop-in replacement for Mailgun, Postmark, and SendGrid without requiring any Composer vendor packages.

Step 1: Configure Environment Variables (.env)

Update your application's .env file with SendPorter's SMTP relay parameters:

# .env
MAIL_MAILER=smtp
MAIL_HOST=smtp.sendporter.com
MAIL_PORT=587
MAIL_USERNAME=sp_live_your_api_key
MAIL_PASSWORD=sp_sec_your_secret_key
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="notifications@yourdomain.com"
MAIL_FROM_NAME="Your Application"

Step 2: Create a Queued Mailable

Generate a mailable that implements ShouldQueue to ensure email delivery never blocks user web requests:

// app/Mail/OrderConfirmation.php
namespace App\Mail;

use App\Models\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class OrderConfirmation extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct(public Order $order) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: "Order Confirmation #{$this->order->id}",
            tags: ['order-confirmation', "tier-{$this->order->tier}"],
            metadata: ['order_id' => (string) $this->order->id],
        );
    }

    public function content(): Content
    {
        return new Content(
            markdown: 'emails.orders.confirmation',
        );
    }
}

Step 3: Dispatching via Laravel's Mail Facade

Trigger email dispatches inside your controllers, listeners, or job queues:

use App\Mail\OrderConfirmation;
use Illuminate\Support\Facades\Mail;

// Dispatch asynchronously to Redis/database queue
Mail::to($user->email)->queue(new OrderConfirmation($order));

Customizing Headers & Parcel Metadata

SendPorter parses standard custom email headers to enrich your parcel receipts in the dashboard. You can attach campaign categories, tenant IDs, and customer references directly in Laravel:

  • X-SendPorter-Tag: onboarding — Groups messages in the analytics reporting dashboard.
  • X-SendPorter-Metadata-Tenant: 1049 — Associates messages with specific tenant accounts for billing.
  • X-SendPorter-Track-Clicks: true — Enables granular link engagement tracking with zero DNS delay.

Frequently Asked Questions

Does SendPorter support Laravel Notifications?

Yes. Any notification using the 'mail' channel will automatically route through SendPorter's SMTP transport without changing a line of notification code.

How does SendPorter track parcel receipts in Laravel?

When SendPorter accepts an email, an SMTP message-id is returned that maps directly to our parcel tracking engine. You can inspect delivery handshakes, ISP status, and open rates in your dashboard.

Can I send attachments with Laravel and SendPorter?

Yes. Standard PDF invoices, receipt attachments, and inline images up to 25MB are fully supported via Laravel's attach() and attachFromStorage() methods.

Connect your Laravel app to SendPorter

Start sending in under two minutes with 2,500 free emails monthly.

Request Access