Autowired setup & reliable delivery

Send email in Symfony

Add email sending to your Symfony application in minutes with Sidemail's official PHP SDK and developer‑friendly API. Sidemail takes care of deliverability, SPF/DKIM/DMARC, templates, and infrastructure so your Symfony controllers can send reliable, production‑ready emails with minimal setup.

Get startedRead API docs
Send a welcome email from a controller
use Sidemail\Sidemail;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;

class RegistrationController
{
    #[Route('/register', methods: ['POST'])]
    public function register(Sidemail $sidemail): JsonResponse
    {
        // ... create user

        $sidemail->sendEmail([
            'toAddress'     => $user->getEmail(),
            'fromAddress'   => '[email protected]',
            'fromName'      => 'Your App',
            'templateName'  => 'Welcome',
            'templateProps' => ['firstName' => $user->getFirstName()],
        ]);

        return new JsonResponse(['status' => 'registered']);
    }
}

Quickstart: Send email in Symfony

Start sending emails from your Symfony app in three steps:

1

Install the Sidemail PHP SDK

Add Sidemail to your Symfony project via Composer:

composer require sidemail/sidemail
2

Configure as a Symfony service

Register the Sidemail client in config/services.yaml so Symfony can autowire it into your controllers. The SDK reads SIDEMAIL_API_KEY from your environment automatically.

# config/services.yaml
services:
    Sidemail\Sidemail:
        autowire: true
3

Send email from a controller

Type-hint Sidemail in your controller action and call sendEmail. Pass the recipient, sender, and template or content. That's it.

use Sidemail\Sidemail;
use Symfony\Component\Routing\Attribute\Route;

class RegistrationController
{
    #[Route('/register', methods: ['POST'])]
    public function register(Sidemail $sidemail): JsonResponse
    {
        // ... create user

        $sidemail->sendEmail([
            'toAddress'     => $user->getEmail(),
            'fromAddress'   => '[email protected]',
            'fromName'      => 'Your App',
            'templateName'  => 'Welcome',
            'templateProps' => ['firstName' => $user->getFirstName()],
        ]);

        return new JsonResponse(['status' => 'registered']);
    }
}

Key features & perks

Why Sidemail for Symfony emails

  • Effortless Symfony email integration

    Send emails from Symfony controllers in minutes. The PHP SDK plugs right into Symfony's autowiring and DI container with zero extra bundles. Clear docs and copy‑paste examples get you sending in under 30 minutes.
  • Reliable email delivery

    Sidemail's proven infrastructure and careful sender vetting process make sure your emails consistently hit inboxes, not spam folders. A dependable choice for developers who need solid delivery without the overhead.
  • Custom sending domain with DKIM & SPF

    Send from your own domain without the painful DNS configuration. Sidemail sets up DKIM and SPF automatically – two of the most critical factors for strong inbox delivery and sender reputation.
  • All‑in‑one email platform

    Sidemail handles everything in one place – transactional and marketing emails, newsletters, email automation, subscriber collection, and contact management. One platform covering every email use case.
  • Premade email templates & no‑code editor

    Sidemail ships with battle‑tested email templates that look great across every client. Want something custom? The no‑code editor lets you build responsive templates from scratch without writing any HTML.
  • Best‑in‑class developer experience

    Sidemail's email API is built for busy developers – clear docs, copy‑paste code examples, and features that make integration painless. From markdown email support and detailed delivery logs to an MCP server and rich API data, Sidemail is the email platform developers actually enjoy using.

Symfony transactional email examples

With Sidemail, you can send any transactional email from Symfony. Here are a few examples with code:

// Symfony: Send an account verification email
#[Route('/register', methods: ['POST'])]
public function register(Sidemail $sidemail): JsonResponse
{
    // ... create user, generate token

    $sidemail->sendEmail([
        'toAddress'     => $user->getEmail(),
        'fromAddress'   => '[email protected]',
        'fromName'      => 'Your App',
        'templateName'  => 'Email Verification',
        'templateProps' => [
            'verifyUrl' => 'https://yourapp.com/verify?token=' . $token,
        ],
    ]);

    return new JsonResponse(['status' => 'registered']);
}

Verification email

Send a sign-up verification email with a one-time link or code to confirm the user's address.

  • Include a clear call-to-action (button or link) in verification emails and make the verification link expire for security.
  • Sidemail includes a ready-made account activation template for this common use case.
See account activation email template
// Symfony: Send a payment receipt email
$sidemail->sendEmail([
    'toAddress'     => $user->getEmail(),
    'fromAddress'   => '[email protected]',
    'fromName'      => 'Your App',
    'templateName'  => 'Payment Receipt',
    'templateProps' => [
        'userName' => $user->getFirstName(),
        'amount'   => '$19.99',
        'date'     => (new \DateTime())->format('M j, Y'),
    ],
]);

Receipt or notification email

Send a receipt, invoice, or generic notification to your user.

  • For receipts or order confirmations, include key details (amount, date, items) in the email.
  • Use templateProps to dynamically populate Sidemail's receipt and invoice templates with your data.
See receipt email template
// Symfony: Schedule a welcome email for 1 hour from now
$sidemail->sendEmail([
    'toAddress'     => '[email protected]',
    'fromAddress'   => '[email protected]',
    'fromName'      => 'Your App',
    'templateName'  => 'Welcome',
    'templateProps' => ['firstName' => 'Alex'],
    'scheduledAt'   => (new DateTime('+1 hour'))->format(DateTime::ATOM),
]);

Welcome email with scheduled delivery

Schedule a welcome email to be delivered later, for instance one hour after the user signs up.

  • Use the scheduledAt field with an ISO timestamp to control exactly when the email is sent.
  • Great for onboarding flows where you want to delay the first message until the user has had time to explore your app.
See welcome email template
// Symfony: Send a password reset email with Markdown
$markdown = file_get_contents(
    $this->getParameter('kernel.project_dir') .
    '/templates/emails/password-reset.md'
);

$sidemail->sendEmail([
    'toAddress'     => '[email protected]',
    'markdown'      => $markdown,
    'templateProps' => [
        'firstName' => 'Alex',
        'resetLink' => 'https://yourapp.com/reset?token=abc123xyz',
        'expiresIn' => '30 minutes',
    ],
]);
---
subject: "Reset your password"
fromAddress: "[email protected]"
fromName: "Your App Security"
---

Hi {firstName}, we received a request to reset your password.

[$btn Reset password]({resetLink})

This link expires in {expiresIn}.

Password reset email sent with Markdown

Sidemail's API lets you write email content in Markdown, which is automatically converted into pixel‑perfect, responsive emails that render beautifully in every inbox and on every device. Each email is branded with your logo and styled to match your project's email design.

  • Store your password reset email in a .md file under your Symfony templates directory
  • Subject and sender are defined in the markdown frontmatter.
  • Pass dynamic values via templateProps(such as resetLink and expiresIn), which map directly to variables in your markdown.

Deliverability best practices

SPF, DKIM, and DMARC for transactional email

SPF and DKIM are authentication protocols that verify your emails are legitimately sent from your domain. And DMARC builds on both by instructing mail servers how to handle messages that fail those checks. Together, they are 3 critical factors for inbox delivery and sender reputation.

Sidemail automatically handles SPF, DKIM, and DMARC setup for you, so your Symfony application sends authenticated, best‑practice‑compliant emails right out of the gate.

Sidemail dashboard – Reliable email delivery
Graphics
Sidemail dashboard – No-code email editor
Graphics

The simplest way to build emails

No‑code email editor & premade email templates

Sidemail's no‑code email editor is the fastest way to create responsive email templates that render correctly across every email client and device. No HTML knowledge needed. Add your logo and brand colors, and you're good to go.

Need something faster? Sidemail includes a library of production‑ready templates for the most common use cases – password resets, welcome emails, receipts, and more. Whether you're starting from scratch or customizing a premade template, your emails are guaranteed to look great everywhere.

Learn more

Developer‑friendly formatting

Markdown support for Symfony emails

Maintaining HTML emails by hand is tedious, especially when you just need to send clean, readable content.

Sidemail lets you write your email body in Markdown and automatically converts it into a responsive, well‑styled HTML email. You get smart formatting – headings, lists, links, and code blocks – without worrying about broken layouts or cross‑client rendering issues.

Perfect for transactional emails sent from your Symfony app – clean content, rapid authoring, and zero HTML to maintain.

Learn more
Markdown email code example and rendered preview

Get started today

Ready to send transactional emails from your Symfony application? With Sidemail's API and premade templates, you can integrate in minutes and deliver emails reliably.

Start free trial

FAQs

How do I send email in Symfony?

The simplest way to send email from a Symfony app is by using an email API like Sidemail. Install the PHP SDK (composer require sidemail/sidemail), register it in config/services.yaml for autowiring, and call $sidemail->sendEmail() in your controller. No SMTP setup or Symfony Mailer configuration needed. Sidemail handles authentication, formatting, and deliverability.

Does Sidemail integrate with Symfony's dependency injection?

Yes. Register the Sidemail\Sidemail class in services.yaml with autowire enabled and Symfony injects it into any controller or service automatically. No extra bundles or factories needed.

Can I use Sidemail with Symfony Event Subscribers?

Absolutely. Since Sidemail is a plain PHP class that's autowired, you can inject it into any Event Subscriber or Listener. For example, listen to a UserRegisteredEvent and send a welcome email from the subscriber instead of the controller. This keeps your email logic decoupled from your request handling.

How do I use email templates with Symfony and Sidemail?

In the Sidemail dashboard, pick a premade template or create your own with the drag‑and‑drop editor. In your Symfony controller, reference the template by templateName and pass dynamic data via templateProps. Sidemail merges the data and delivers a well‑formatted email. No Twig + Inky + CSS inlining is necessary.

Do I need Symfony Mailer to use Sidemail?

No. Sidemail's PHP SDK makes direct API calls, bypassing Symfony Mailer entirely. You don't need to configure an SMTP transport or install the Mailer component. A single Composer package and your API key are all that's required.

How do I handle email errors in Symfony?

Wrap your $sidemail->sendEmail() call in a try/catch block and catch Sidemail\SidemailException. The exception provides the HTTP status, error code, and a human‑readable message. Log it with Symfony's Logger service and return an appropriate response.