I'm trying to make a beautiful email template with Symfony 3 but except the basic html code like an balise nothing is working.
Here is my parent template :
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
{% block stylesheets %}
{% stylesheets
'bundles/platform/bootstrap/css/bootstrap.min.css'
'bundles/platform/bootstrap/fonts/glyphicons-halflings-regular.eot'
'bundles/platform/bootstrap/fonts/glyphicons-halflings-regular.svg'
'bundles/platform/bootstrap/fonts/glyphicons-halflings-regular.ttf'
'bundles/platform/bootstrap/fonts/glyphicons-halflings-regular.woff'
'bundles/platform/bootstrap/fonts/glyphicons-halflings-regular.woff2'
filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
{% endblock %}
</head>
<body>
<div id="content-block" class="row">
{% block contentBlock %}
{% endblock %}
</div>
{% block javascripts %}
{% javascripts
'@PlatformBundle/Resources/public/bootstrap/js/bootstrap.min.js'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
</body>
</html>
The child template :
{% extends "PlatformBundle:Emails:template_email.html.twig" %}
{% block contentBlock %}
<div class="text-center"><h2>New asking</h2></div>
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 col-lg-offset-2 col-md-offset-2 col-sm-offset-2 col-xs-offset-2 well">
<p> ask from : {{authorEmail}} </p>
<p> Subject: {{subject}} </p>
<p> {{content}} </p>
</div>
{% endblock %}
And finally the function who send the mail in my controller :
$renderedTemplate = $this->container->get('templating')
->render('PlatformBundle:Emails:contact_from_user.html.twig', array('subject' => $subject, 'authorEmail' => $authorEmail, 'content' => $content));
$message = \Swift_Message::newInstance()
->setSubject($subject)
->setFrom($platform->getEmail())
->setTo($toEmail)
->setBody($renderedTemplate, 'text/html');
So, my question is : How to make my template use the attached css or if it's not possible how to render a beautiful email like that for exemple :
EDIT :
For those who want, here is a great template for responsive e-mail who show good stuff to masteries this : responsive-html-email-template
