Reliable email API for PHP developers
An email API that fits right into your PHP apps with production-ready SDKs and clean documentation. Get 500 emails/month free or upgrade for as little as $7.
PHP email that just works
Clean, modern PHP API
Built for modern PHP (7.4+) with a clean, chainable interface that keeps your code readable.
Universal HTTP client support
Plays nicely with your preferred HTTP client thanks to PSR-7 and PSR-18 support.
Exceptions you can branch on
Proper error handling built in with dedicated exceptions for validation and rate limit errors.
Infrastructure you can rely on
Precision-engineered infrastructure with outstanding deliverability at every level and 99.99% standard uptime.
Fast, straightforward integration with your PHP app
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\Recipient;
use MailerSend\Helpers\Builder\EmailParams;
$mailersend = new MailerSend();
$recipients = [
new Recipient('your@client.com', 'Your Client'),
];
$emailParams = (new EmailParams())
->setFrom('your@domain.com')
->setFromName('Your Name')
->setRecipients($recipients)
->setSubject('Subject')
->setHtml('This is the HTML content')
->setText('This is the text content')
->setReplyTo('reply to')
->setReplyToName('reply to name');
$mailersend->email->send($emailParams);
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\Recipient;
use MailerSend\Helpers\Builder\EmailParams;
$mailersend = new MailerSend();
$bulkEmailParams = [];
$bulkEmailParams[] = (new EmailParams())
->setFrom('your@domain.com')
->setFromName('Your Name')
->setRecipients([
new Recipient('recipient1@client.com', 'Your Client'),
])
->setSubject('Subject')
->setHtml('This is the HTML content')
->setText('This is the text content');
$bulkEmailParams[] = (new EmailParams())
->setFrom('your@domain.com')
->setFromName('Your Name')
->setRecipients([
new Recipient('recipient2@client.com', 'Your Client'),
])
->setSubject('Subject')
->setHtml('This is the HTML content')
->setText('This is the text content');
$mailersend->bulkEmail->send($bulkEmailParams);
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\ActivityParams;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->activity->find('activity_id');
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\DomainParams;
$mailersend = new MailerSend();
$domainParams = (new DomainParams('domainName'))
->setReturnPathSubdomain('returnPath')
->setCustomTrackingSubdomain('customTracking')
->getInboundRoutingSubdomain('inboundRouting');
$mailersend->domain->create($domainParams);
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\TokenParams;
$mailersend = new MailerSend();
$mailersend->token->create(
new TokenParams('token name', 'domainId', TokenParams::ALL_SCOPES)
);
use MailerSend\Helpers\Builder\WebhookParams;
use MailerSend\MailerSend;
$mailersend = new MailerSend();
$mailersend->webhooks->create(
new WebhookParams('https://webhook_url', 'Webhook name', WebhookParams::ALL_ACTIVITIES, 'domain_id')
);
// Or a disabled webhook
$mailersend->webhooks->create(
new WebhookParams('https://webhook_url', 'Webhook name', WebhookParams::ALL_ACTIVITIES, 'domain_id', false)
);
// Or with a specific webhook payload version (1 or 2)
$mailersend->webhooks->create(
new WebhookParams('https://webhook_url', 'Webhook name', WebhookParams::ALL_ACTIVITIES, 'domain_id', true, 2)
);
The tools you need to start sending today
API documentation
An in-depth API reference that covers all MailerSend features and endpoints.
GitHub repository
The official MailerSend PHP SDK with usage examples you can drop right into your code.
Developer guide
Our technical guide to setting up the MailerSend PHP SDK and sending your first email.
PHP help article
An in-depth article with steps and examples for sending different emails with PHP using API or SMTP.
Ready to give it a go?
You can send your first email in minutes with a free Trial account.
Domain authentication handled automatically
Add your domain, use the auto-connect wizard to automatically configure SPF, DKIM and MX records, and get sending. No manual configuration needed.
Webhook-powered event handling
Set up webhook endpoints in your PHP app and react instantly with your own business logic to deliveries, bounces, opens, clicks, and more. No polling, no guesswork.
Scale for multiple channels without switching APIs
Go beyond email and integrate SMS (USA & Canada) and WhatsApp (coming soon) without the need for multiple platforms or accounts. More channels, one platform, one API, one SDK.
End-to-end visibility across every send
-
API & SMTP logs
Inspect every API request and SMTP transaction with detailed logs that help you spot patterns and debug faster. -
Real-time activity tracking
Monitor message status across your entire sending pipeline, from queued to clicked and everything in between. -
DMARC monitoring
Get full visibility into SPF, DKIM and DMARC alignment across every domain sending on your behalf with DMARC reports.
Keep dynamic templates outside your codebase
Manage templates in MailerSend, inject dynamic content at the point of sending, and let your team easily update designs without redeployment.
Route incoming emails straight to your PHP app
Out-of-the-box inbound routing lets you effortlessly parse incoming email data as clean, structured JSON and route it to a webhook endpoint or email address.
An endpoint for every stage of your workflow
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
Technical support 24/7
Get fast, responsive support when you need it from an award-winning support team. Real help is just a click away via email or live chat.
Dev-approved, team-friendly
Send your first email now
Sign up and send your first email in minutes with a trial domain. Get 500 emails/month free or upgrade for as little as $7/month for more emails and features.
Explore all features
Analytics
Access a wide range of metrics to learn how to improve email deliverability and engagement.
Blocklist monitoring
Get real-time alerts about your domain or IP’s blocklist activity.
User management
Invite your team members to collaborate on projects by assigning roles and granting permissions.
Drag & drop builder
Our drag & drop email editor empowers you to create professionally-designed transactional emails.
Email verification
Verify a single email address or upload an entire email list to verify in bulk.
Suppressions management
Protect your sending reputation by adding email addresses and domains that you should not send to.
And much more to deliver, every single time
FAQs
What are the minimum PHP version requirements for the SDK?
MailerSend’s SDK is compatible with PHP 7.4 and above.
Which PSR standards does this library use for HTTP requests?
The MailerSend SDK supports PSR-7 and PSR-18.
How do I add attachments like images or PDFs to my emails?
To add attachments to your emails, you can use the $attachments parameter. Check our GitHub documentation for an example.
Does the SDK handle bulk email sending and status tracking?
Yes, the MailerSend PHP SDK has endpoints for sending bulk emails and activity.
Can I programmatically manage webhooks and inbound routing?
Yes, our API covers all MailerSend features.
Is this SDK compatible with older versions of Laravel?
The latest version of our SDK is not compatible with Laravel 8.0 or lower. We recommend that you use an older version of the SDK or, preferably, update your Laravel version.
Does the SDK support both HTML and plain text email formats?
Yes, you can send HTML, plain text or templated emails.
Is it possible to schedule emails to be sent at a future date and time?
Yes, you can schedule emails using the send_at parameter.
Can I use this library to send and manage transactional SMS?
Yes, the library includes endpoints for sending and managing transactional SMSes. Note that SMS is currently only available for senders in the USA and Canada.
What are MailerSend’s rate limits?
The API rate limit for all endpoints (excluding v1/email) is 60 requests/minutes, and for v1/email the limit is 120 requests/minutes. For details about bulk request limits, check our guide on rate limits.