Commit 75fd4d06 authored by Mat's avatar Mat

Quelques essais de styles html dans un mail

parent 44f8c12c
......@@ -37,6 +37,10 @@ class SendMailCommand extends ContainerAwareCommand
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
* @throws \Twig_Error_Loader
* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
......
......@@ -18,6 +18,9 @@ class DefaultController extends MasterController
/**
* @param Newsletter $newsletter
* @return \Symfony\Component\HttpFoundation\Response
* @throws \Twig_Error_Loader
* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
*/
public function testAction(Newsletter $newsletter)
{
......
......@@ -3,9 +3,25 @@
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body { background-color: #bfd5e0; color: #672126; padding: 3em; }
.brand { background-color: #2d2a2a; padding: 1em; }
.brand span { color: white; font-size: 1.25rem; margin-bottom: 10px; }
.brand img { height: 40px; }
</style>
</head>
<body>
<div class="brand">
{# ne marche pas en local car http://localhost
<img src="{{ absolute_url(asset('css/img/radis.1inv.png')) }}" alt="logo">
#}
<img src="http://potage.domainepublic.site/web/css/img/radis.1inv.png" alt="logo absolu">
<span>Potage</span>
</div>
<h1>Mon template twig</h1>
<h2>{{ subject }}</h2>
<h3>{{ to }}</h3>
{{ body }}
</body>
</html>
\ No newline at end of file
......@@ -34,7 +34,9 @@ class Newsletter
$mailer = $this->container->get('mailer');
$twig = $this->container->get('twig');
// Destinataire, l'application elle-même
$from = ['postmaster@potage.domainepublic.site' => 'Potage'];
$message = (new \Swift_Message())
->setFrom($from)
......@@ -43,7 +45,8 @@ class Newsletter
->setBody(
$twig->render('@Potage/Mail/bodyMail.html.twig', array(
'body' => $body,
'name' => 'coucou'
'to' => $to,
'subject' => $subject
)),
'text/html'
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment