5.1.0 2018-07-10 04:40 UTC


This bundle provides an easily configurable façade for sending transactional emails without having to build the message from scratch every time.

It has a limited scope by design, it's not infinitely configurable and it's not made to work outside a typical Symfony installation.


Step 0: Before we begin

Under the hood, QuickMailer uses Twig as its template engine, SwiftMailer to actually send the messages and Monolog to keep tabs on what is happening.

Make sure that those three bundles are installed and properly configured.

Step 1: Download the bundle

Open a terminal, cd into your project directory and execute the following command to download the latest stable version of this bundle:

composer require felds/quick-mailer-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

If you are using Symfony Flex and have contrib recipes enabled, it's all done.


to be done


Step 1: Create a template

Using this bundle, the whole message is composed from a single twig template.

The typical message looks something like this:

{# templates/email/cookie.html.twig #}

{% block subject %}
Hey, {{ name|title }}! You've got a cookie!
{% endblock %}

{% block html %}
  <strong>{{ name|title }}</strong>, take this delicious <em>{{ flavor }}</em> cookie!
{% endblock %}

{% block text %}
{{ name|title }}, take this delicious {{ flavor }} cookie!
{% endblock %}

Of course, you can use includes, extends and everything else available on Twig (even your own extensions!). Just keep in mind that each main block (subject, html and text) are rendered separately, and they are not visible to one another. Ex: a set declared outside the html block will not work inside it.

Step 2: Add it to the configuration

# config/packages/felds_quickmailer.yaml
    # ...
        cookie: email/cookie.html.twig

Step 3: Send the email


use Felds\QuickMailerBundle\Model\Mailable;
use Felds\QuickMailerBundle\QuickMailer;

class FooController
    public function barAction(QuickMailer $qm)
        $recipient = new Mailable('Recipient', 'recipient@example.com');

        $qm->get('cookie')->sendTo($recipient, [
            'name'    => $recipient->getName(),
            'flavor'  => 'blueberry',

To do


  • Add tests


  • Config reference
  • Examples of how to integrate it with other tools
  • Guides