SMTP

Laravel (SMTP)

Send email from Laravel through MailBlastr using the built-in SMTP mailer.

Laravel's mail service speaks SMTP out of the box. Point its smtp mailer at the MailBlastr relay and authenticate with your API key — then send Mailables exactly as you normally would. SMTP sends appear in your dashboard and event log just like API sends.

Prerequisites

1. Configure your environment

Add your MailBlastr SMTP details to your application's .env file. The MAIL_FROM_ADDRESS must be on a verified domain.

.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailblastr.com
MAIL_PORT=587
MAIL_USERNAME=mailblastr
MAIL_PASSWORD=mb_xxxxxxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=onboarding@yourdomain.com
MAIL_FROM_NAME=Acme

2. Send an email

You're ready to send with Laravel's Mail facade. Here's an example controller dispatching a Mailable:

OrderShipmentController.php
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Mail\OrderShipped;
use App\Models\Order;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

class OrderShipmentController extends Controller
{
    /**
     * Ship the given order.
     */
    public function store(Request $request): RedirectResponse
    {
        $order = Order::findOrFail($request->order_id);

        // Ship the order...

        Mail::to($request->user())->send(new OrderShipped($order));

        return redirect('/orders');
    }
}
For implicit TLS, set MAIL_PORT=465 and MAIL_ENCRYPTION=ssl. See Send an email if you prefer the HTTP API.