Skip to main content

Introduction

Laravel’s mail system is powered by Symfony Mailer and supports SMTP, Mailgun, Postmark, Resend, Amazon SES, and sendmail out of the box. Each type of email you send is represented as a mailable class. Mailables encapsulate all the configuration—who it’s from, the subject, the view, and attachments—in one place.

Configuration

Mail configuration lives in config/mail.php. Set the default driver and credentials via .env:
After installing the package, set MAIL_MAILER in .env to the driver name (mailgun, postmark, resend, or ses) and add the corresponding credentials to config/services.php.

Generating mailables

Create a mailable class with Artisan:
This generates app/Mail/OrderShipped.php.

Writing mailables

A mailable class defines three methods:
  • envelope() — from address and subject
  • content() — the Blade view to render
  • attachments() — files to attach
Public properties of the mailable are automatically available in the Blade view:

Adding attachments

Attach files using the Attachment class:

Markdown mailables

Markdown mailables use Laravel’s pre-built email components to produce responsive, well-designed emails without writing custom HTML. Generate a Markdown mailable:
This creates the mailable class and a Markdown Blade template at resources/views/emails/orders/shipped.blade.php:
The content method uses markdown instead of view:
Markdown mailables are the easiest way to create good-looking transactional emails. Laravel handles the responsive HTML and plain-text fallback automatically.

Sending mail

Use the Mail facade to send a mailable:
Send to multiple recipients:

Queueing mail

Email sending can be slow. Queue the mailable to return a response immediately:
To make a mailable always queue when sent, implement ShouldQueue on the class:
Now Mail::to(...)->send(new OrderShipped($order)) queues automatically.

Specifying queue connection and name via PHP attributes

You can use PHP attributes to declare the queue connection and queue name directly on the mailable class, instead of chaining onConnection() and onQueue() at dispatch time:
This makes the queue configuration visible in the class definition itself.

Sending after the response

Use Mail::to(...)->sendNow() or Mail::later() to control timing. To send right after Laravel returns the HTTP response:

Previewing mailables in the browser

Return a mailable from a route to inspect it during development:

Testing mailables

Assert a mailable was sent without actually sending email:

Local development

During development, set the log mailer to write all outgoing emails to your log file instead of sending them:
Or use Mailpit to catch emails locally:

A complete example

1

Generate the mailable

2

Define the mailable class

3

Write the Blade template

4

Send after user registration

Notifications

Send multi-channel notifications—email, SMS, Slack, and database—with a single notification class.
Last modified on June 21, 2026