Send emails with Laravel API
Fast, reliable transactional email API for your Laravel projects.
Start sending now with the official Laravel driver
<?php
namespace App\Mail;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Arr;
use MailerSend\Helpers\Builder\Personalization;
use MailerSend\Helpers\Builder\Variable;
use MailerSend\LaravelDriver\MailerSendTrait;
class TestEmail extends Mailable
{
use Queueable, SerializesModels, MailerSendTrait;
/**
* Create a new message instance.
*/
public function __construct()
{
//
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Test Email',
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
$to = Arr::get($this->to, '0.address');
// Additional options for MailerSend API features
$this->mailersend(
template_id: null,
tags: ['tag'],
personalization: [
new Personalization($to, [
'var' => 'variable',
'number' => 123,
'object' => [
'key' => 'object-value'
],
'objectCollection' => [
[
'name' => 'John'
],
[
'name' => 'Patrick'
]
],
])
],
precedenceBulkHeader: true,
sendAt: new Carbon('2022-01-28 11:53:20'),
);
return new Content(
view: 'emails.test_html',
text: 'emails.test_text'
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [
Attachment::fromStorageDisk('public', 'example.png')
];
}
}
Laravel email done right
Straightforward integration
Quick to integrate with the official MailerSend driver, in-depth documentation and API reference.
Built for Laravel
Works seamlessly with Laravel’s Mailer service for smooth, reliable email delivery for your Laravel projects.
Developer-first
Created by developers, for developers, with a focus on features that you actually need and simple implementation.
Reliable sends
Managed by deliverability experts to reduce bounces and spam complaints and reach more inboxes.
SMTP-ready for traditional workflows
Secure and robust SMTP relay for integration with legacy systems or existing Mailer setups. Simply plug in your SMTP server credentials and start sending.
Transactional emails personalized at scale
Easily create dynamic email templates personalized with order information, account activity, reservation details and more. One template, thousands of unique sends.
Your debugging toolkit
-
API & SMTP logs
Get full visibility into every request, response and template error with searchable logs. -
Real-time activity and analytics
From Queued to Clicked, keep track of every message in the activity dashboard, plus create custom analytics reports in a few clicks. -
Webhook notifications
Trigger notifications via webhooks for all message events: bounces, spam complaints, unsubscribes and more.
Smart email routing
Capture and parse incoming emails with inbound routing, then route them to endpoints or addresses. Automate workflows, feed data into apps or CRMs, and build email-driven features.
Real-time email validation API
Integrate real-time email verification checks at the point of signup to validate addresses before they get submitted. Keep your database clean and provide instant feedback to users.
The tools you need to get started
API reference
Explore all MailerSend API features, endpoints and usage in detail.
Github repository
Pre-requisites and how to get started with Laravel usage examples.
Developer guides
Technical guides for sending emails, customizing email content and more
Laravel help article
An in-depth article with examples for sending emails with Laravel via API or SMTP.
An endpoint for every feature
Send order confirmations, password resets, OTPs and more.
/bulk-email
Send service updates, event reminders, and account summaries.
/activity
Create custom dashboards or integrate activity metrics into other apps.
analytics
Automate reports, pull data into internal tools, or trigger conditional logic.
/domains
Automate domain setup and get an overview of active domains.
/inbound
Manage inbound routes and create user-specific routes on signup.
/recipients
Share recipient data across tools to sync contacts and manage suppressions.
/templates
Send with email templates that look professional and contain dynamic content.
/email-verification
Configure forms to perform real-time email validation or verify a whole list.
/sms
Send appointment reminders, 2FA messages, shipping updates and more.
/smtp-users
Programmatically create SMTP users during environment setup.
View more endpoints
Get help whenever you need it
Need help getting started, troubleshooting an issue, or trying out an advanced feature? Our award-winning customer support team is just a click away.
Dev-approved, team-friendly
Meet our SDKs
Start sending now
Sign up for the free trial to try out hassle-free email sending for your Laravel projects. Subscribe to the Free plan for up to 500 emails/month.
Pricing
Professional
For agencies and white-label resellers sending at scale
Starter
For growing startups and small businesses
Hobby
For personal projects and side hustles
Free
For occasional email testing and sending
Enterprise
For large organizations with special requirements
-
14-days API logs retention
-
Enterprise-grade support
-
Dedicated IP
FAQs
Why should I use the MailerSend driver over Laravel's default SMTP driver?
MailerSend’s Laravel mail driver uses our secure, reliable email API for high deliverability and advanced features. Laravel’s own recommended method is to use an API with an official driver.
What are the prerequisites for using MailerSend with my Laravel project?
To use MailerSend’s email service with your Laravel application, you’ll need Laravel 9.0+, PHP 8.0+, Guzzle 7.0+, and a MailerSend API key.
Does MailerSend support sending personalized emails with dynamic templates via the API?
Yes, MailerSend supports dynamic email templates and personalization.
Where can I find my API key to configure the driver?
From the MailerSend dashboard, go to Email, Domains, click on your domain, and go to the API tokens section. Learn more about managing API keys.
How difficult is it to set up and configure the MailerSend driver?
We’ve made it as simple as possible for developers with experience using Laravel to get started and provide ample documentation on how to do so. Learn more about the MailerSend Laravel driver.
Can I use my existing Laravel Mailables and notifications?
Yes, you’ll need to configure Laravel to use MailerSend as the default mailer in your configuration file.
Is there a free plan to test the Laravel integration?
Yes, there is a Trial plan, which includes a free trial domain for testing and 100 emails. You can also subscribe to a Free plan, which gives you 500 emails per month or upgrade for as little as $7 per month for more emails. Learn more about our plans, features and limits.
What kinds of emails can I send with MailerSend’s Laravel driver?
You can send all kinds of transactional messages, alerts and notifications with MailerSend and Laravel, including e-commerce emails, such as order confirmations and shipping updates, transactional emails for SaaS, such as OTPs and password resets, and messages for banks and financial services, such as account statements and security alerts. Check out our transactional email solutions page for more ways to use MailerSend.