Simple setup & reliable delivery
Add email sending to your PHP application in minutes using Sidemail's clean API and official PHP SDK. Sidemail takes care of deliverability, authentication, and infrastructure so your PHP code simply calls an API and your users get the email in their inbox.
Get startedRead API docs$sidemail->sendEmail([
'toAddress' => $user['email'],
'fromAddress' => '[email protected]',
'fromName' => 'Your App',
'templateName' => 'Welcome',
'templateProps' => [
'firstName' => $user['name'],
],
]);Three steps to start sending emails from your PHP app:
Add Sidemail to your project with Composer:
composer require sidemail/sidemailRequire the autoloader and create a Sidemail instance. The SDK automatically reads SIDEMAIL_API_KEY from your environment.
require_once __DIR__ . '/vendor/autoload.php';
use Sidemail\Sidemail;
$sidemail = new Sidemail();
// or with explicit key: new Sidemail(apiKey: 'your-api-key');Call the sendEmail method with recipient, sender, and either a template name or raw content. That is all it takes to send email from PHP through Sidemail's API.
// Example: send a welcome email template
$sidemail->sendEmail([
'toAddress' => '[email protected]',
'fromAddress' => '[email protected]',
'fromName' => 'Your App',
'templateName' => 'Welcome', // template stored in Sidemail
'templateProps' => ['firstName' => 'Alice'], // dynamic data for the template
]);Key features & perks
mail() function can be unreliable, hard to debug, and gives you zero visibility into what happens after sending. Sidemail provides you with a modern API, detailed delivery logs, unlimited sending history, and fast and reliable deliverability. It is the upgrade your PHP app deserves.Sidemail makes it easy to send any transactional email from PHP. Here are a few common examples:
// PHP: Send a password reset email using a Sidemail template
$sidemail->sendEmail([
'toAddress' => $user['email'],
'fromAddress' => '[email protected]',
'fromName' => 'Your App',
'templateName' => 'Password Reset',
'templateProps' => [
'actionUrl' => 'https://yourapp.com/reset?token=' . $token,
],
]);Send a secure password reset link when a user submits the forgot password form.
// PHP: Send a payment receipt email
$sidemail->sendEmail([
'toAddress' => $user['email'],
'fromAddress' => '[email protected]',
'fromName' => 'Your App',
'templateName' => 'Payment Receipt',
'templateProps' => [
'userName' => $user['name'],
'amount' => '$19.99',
'date' => date('F j, Y'),
],
]);Automatically send a receipt or invoice after a successful payment.
templateProps to populate amounts, names, and line items.// PHP: Schedule a welcome email for 1 hour from now
$scheduledAt = (new DateTime('+1 hour'))->format(DateTime::ATOM);
$sidemail->sendEmail([
'toAddress' => '[email protected]',
'fromAddress' => '[email protected]',
'fromName' => 'Your App',
'templateName' => 'Welcome',
'templateProps' => ['firstName' => 'Alex'],
'scheduledAt' => $scheduledAt,
]);Schedule a welcome email to arrive later, for example one hour after the user signs up.
scheduledAt field to an ISO 8601 timestamp to control exactly when the email is delivered.// PHP: Send a security alert email with Markdown content
$markdown = file_get_contents(
__DIR__ . '/templates/emails/security-alert.md'
);
$sidemail->sendEmail([
'toAddress' => '[email protected]',
'markdown' => $markdown,
'templateProps' => [
'name' => $user['name'],
'device' => 'MacBook Pro',
'location' => 'Berlin, Germany',
'reviewLink' => 'https://yourapp.com/security/activity',
],
]);---
subject: "Security alert: new login detected"
fromAddress: "[email protected]"
fromName: "Your App Security"
---
Hi {name},
We noticed a new login from **{device}** in **{location}**.
[$btn Review security activity]({reviewLink})
If this was not you, please reset your password now.Use Markdown to send clear security notifications when a login event needs user attention. Sidemail converts your Markdown to responsive HTML and keeps the final email aligned with your project branding.
.md filetemplateProps to inject dynamic values like device, location, and review links directly into your markdown content.Deliverability best practices
SPF, DKIM, and DMARC are email authentication protocols that prove your messages are legitimately sent from your domain. Together, they are the three most important factors for inbox placement and protecting your sender reputation.
Sidemail sets up SPF, DKIM, and DMARC for you automatically. So, your PHP application sends fully authenticated emails from day one, with no manual DNS work required.




The simplest way to build emails
Create responsive email templates with Sidemail's visual editor. No HTML knowledge needed. Pick your brand colors, add your logo, and start sending professional emails in minutes.
Need to move faster? Use one of Sidemail's premade templates for common use cases like password resets, welcome emails, and receipts. Every template is tested across all major email clients and devices, so your emails always look great. Whether you build your email from scratch or customize a premade template, the result is pixel‑perfect every time.
Learn moreDeveloper‑friendly formatting
Building and maintaining HTML emails by hand is painful. When you just need to send clean, readable content, it should not require fighting with inline styles and table layouts.
Sidemail lets you write your email content in Markdown and converts it into a responsive, well‑styled HTML email automatically. Headings, lists, links, code blocks, buttons, and more, all work out of the box.
Perfect for transactional emails sent from PHP. Clean content, fast authoring, zero HTML to debug.
Learn more
Ready to send transactional emails from PHP? Sidemail's API and official PHP SDK make it easy to integrate in minutes and deliver emails reliably.
Start free trialThe simplest way to send email in PHP is with an email API like Sidemail. Install the PHP SDK (composer require sidemail/sidemail), initialize the client, and call the sendEmail() method. No SMTP configuration, no server setup, no unreliable mail() calls. Sidemail handles authentication, formatting, and deliverability for you.
PHP's built‑in mail() function depends on your server's local mail configuration, often sends emails that land in spam, and gives you no visibility into delivery status. Sidemail replaces it with a modern API that includes automatic DKIM and SPF setup, detailed delivery logs, unlimited email history, premade templates, and reliable inbox placement. It is a significant upgrade with very little code change required.
Create or import a template in the Sidemail dashboard using the drag‑and‑drop editor or premade library. Then in PHP, reference the template by name via templateName and pass personalization data through templateProps. For example, a "Welcome" template with a {firstName} variable can be sent with 'templateProps' => ['firstName' => 'Alice']. Sidemail merges the data and delivers a professionally styled email.
Yes. The PHP SDK includes a Sidemail::fileToAttachment() helper. Read the file contents with file_get_contents() and pass it along with the filename. Include the result in the attachments array. Supported file types include PDF, PNG, JPG, and CSV. Keep total attachment size under about 2.5 MB for best results.
Yes. Add a scheduledAt field with a future ISO 8601 timestamp to your sendEmail() call. Sidemail queues the email and delivers it at the specified time. You can view or cancel scheduled emails from the dashboard or via the API.
Yes. The Sidemail PHP SDK works with any PHP project, including Laravel, Symfony, Slim, WordPress, and plain PHP scripts. Install via Composer, initialize the client, and call sendEmail(). Sidemail also provides dedicated guides for Laravel, Symfony, and Slim.
Wrap your sendEmail() call in a try‑catch block and catch Sidemail\SidemailException. The exception message gives you details about what went wrong. Log the error with error_log() or send it to your monitoring system for visibility.