prezent/ink-bundle

Easy responsive e-mails using Foundation and Inky

1.0.1 2023-05-04 09:30 UTC

README

Build Status

Easy responsive e-emails using Foundation and Inky

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller

class AppController extends Controller
{
    public function emailAction()
    {
        $message = $this->get('prezent_ink.factory')->getMessage('AppBundle:Mail:hello.eml.twig', [
            'user' => $this->getUser(),
        ]);

        $message
            ->setFrom('noreply@example.org')
            ->setTo('john.doe@example.org')
        ;

        $this->get('mailer')->send($message);
    }
}
{% extends 'PrezentInkBundle::base.eml.twig' %}

{% block stylesheets %}
    <link rel="stylesheet" href="@AppBundle/Resources/public/css/email.css" />
{% endblock %}

{% block subject %}Hello {{ user.username }}{% endblock %}

{% block body_text %}
Hello {{ user.username }},

Nice to meet you!
{% endblock %}

{% block body_html %}
<container>
    <h1>Hello {{ user.username }},</h1>
    <spacer size="16"></spacer>
    <callout>Nice to meet you!</callout>
</container>
{% endblock %}

The documentation can be found in Resources/doc