PHP Mailables & Queues•Full-Stack PHP Framework

How to Send Transactional Emails in Laravel with Mailofly

Configure Mailofly as your Laravel SMTP or API transport. Seamless integration with Laravel Mailables, Notifications, and asynchronous Queue Workers.

composer require symfony/mailgun-mailer # Optional for API, or use native SMTP
Setup Tutorial

Get Up and Running in 3 Easy Steps

01

Update Laravel .env

Set `MAIL_MAILER=smtp`, `MAIL_HOST=smtp.mailofly.com`, `MAIL_PORT=587`, and your Mailofly API key as `MAIL_PASSWORD`.

02

Create a Mailable

Generate a Mailable class using `php artisan make:mail OrderShipped` and implement `ShouldQueue` for asynchronous processing.

03

Dispatch via Mail facade

Call `Mail::to($user)->queue(new OrderShipped($order))` to dispatch transactional emails through Mailofly's relay.

Production-Ready Code Example

Copy and paste into your project. Fully typed and tested.

app/Mail/OrderShipped.php
<?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 OrderShipped extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct(public Order $order) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: "Your Order #{$this->order->id} Has Shipped!",
        );
    }

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

// In your controller:
// use Illuminate\Support\Facades\Mail;
// Mail::to($request->user())->queue(new OrderShipped($order));
Why Developers Love It

Engineered for Laravel

Zero Package Overhead

Works natively with Laravel's built-in Symfony Mailer SMTP driver. No third-party packages required.

Asynchronous Queue Integration

Dispatch queued emails effortlessly with Redis, Horizon, or database queue workers for blazing fast page loads.

Automated SPF & DKIM Signing

All outbound Laravel mail is authenticated automatically with your domain's SPF, DKIM, and DMARC records.

Got Questions?

Frequently Asked Questions about Laravel

Yes. Mailofly's SMTP relay is fully compliant with Symfony Mailer and works out of the box with Laravel 9, 10, 11, and future releases.

Start Sending from Laravel in Minutes

3,000 free emails every month. Copy your API key, run the code snippet, and watch your delivery logs in real time.