Skip to content
Pimcore 5.x Emailizr - valid email markup generator
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
src/EmailizrBundle
tests
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
ISSUE_TEMPLATE.md
LICENSE.md
PULL_REQUEST_TEMPLATE.md
README.md
UPGRADE.md
codeception.dist.yml
composer.json
easy-coding-standard.yml
phpstan.neon

README.md

Pimcore Emailizr

Pimcore 5.0 Emailizr.

Join the chat at https://gitter.im/pimcore/pimcore Software License Latest Release Travis PhpStan

Requirements

  • Pimcore >= 5.4.0

Installation

"require" : {
    "dachcom-digital/emailizr" : "~1.0.0",
}
  • Create valid email markup with inky and inline styles.
  • Respect editables in pimcore editmode.

Usage

Just extend the emailizr layout:

{% extends '@Emailizr/layout.html.twig' %}

This will include a markup like this. You may want to change it:

{% spaceless %}
{{ emailizr_style_collector.add('@EmailizrBundle/Resources/public/css/foundation-for-emails/foundation.min.css') }}
{% emailizr_inline_style %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width"/>
    {% block headStyles %}
        <style type="text/css">
            {% autoescape false %}
                {{ emailizr_inline_style(emailizr_style_collector) }}
            {% endautoescape %}
        </style>
    {% endblock %}
</head>
{% emailizr_inky %}
    <body>
        {% block body %}
            <table class="body">
                <tr>
                    <td class="center" align="center" valign="top">
                        <center>
                            {% block content %}
                            {% endblock %}
                        </center>
                    </td>
                </tr>
            </table>
            <!-- prevent Gmail on iOS font size manipulation -->
            <div style="display:none; white-space:nowrap; font:15px courier; line-height:0;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
        {% endblock %}
        </body>
{% end_emailizr_inky %}
</html>
{% end_emailizr_inline_style %}
{% endspaceless %}

Service

If you need to parse values in a custom context, you may use the ContentService.

<?php

use EmailizrBundle\Service\ContentService;

class YourClass
{
    protected $contentService;

    public function __construct(ContentService $contentService)
    {
        $this->contentService = $contentService;
    }

    public function parse($content)
    {
        $cssFile = PIMCORE_WEB_ROOT . '/static/css/email.css';

        $fragment = $this->contentService->checkContent($content, $cssFile, FALSE, TRUE, TRUE);

        return $fragment;

    }
}

Further Information

Thanks

  • Thanks to ZurbInk Bundle for pointing the right direction.
  • Thanks to Pinky for the inky php implementation.
  • Thanks to Emogrifier for the css inline integration.
You can’t perform that action at this time.