Commit 75fd4d06 authored by Mat's avatar Mat
Browse files

Quelques essais de styles html dans un mail

parent 44f8c12c
...@@ -37,6 +37,10 @@ class SendMailCommand extends ContainerAwareCommand ...@@ -37,6 +37,10 @@ class SendMailCommand extends ContainerAwareCommand
/** /**
* @param InputInterface $input * @param InputInterface $input
* @param OutputInterface $output * @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) protected function execute(InputInterface $input, OutputInterface $output)
{ {
......
...@@ -18,6 +18,9 @@ class DefaultController extends MasterController ...@@ -18,6 +18,9 @@ class DefaultController extends MasterController
/** /**
* @param Newsletter $newsletter * @param Newsletter $newsletter
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
* @throws \Twig_Error_Loader
* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
*/ */
public function testAction(Newsletter $newsletter) public function testAction(Newsletter $newsletter)
{ {
......
...@@ -3,9 +3,25 @@ ...@@ -3,9 +3,25 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Document</title> <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> </head>
<body> <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> <h1>Mon template twig</h1>
<h2>{{ subject }}</h2>
<h3>{{ to }}</h3>
{{ body }} {{ body }}
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -34,7 +34,9 @@ class Newsletter ...@@ -34,7 +34,9 @@ class Newsletter
$mailer = $this->container->get('mailer'); $mailer = $this->container->get('mailer');
$twig = $this->container->get('twig'); $twig = $this->container->get('twig');
// Destinataire, l'application elle-même
$from = ['postmaster@potage.domainepublic.site' => 'Potage']; $from = ['postmaster@potage.domainepublic.site' => 'Potage'];
$message = (new \Swift_Message()) $message = (new \Swift_Message())
->setFrom($from) ->setFrom($from)
...@@ -43,7 +45,8 @@ class Newsletter ...@@ -43,7 +45,8 @@ class Newsletter
->setBody( ->setBody(
$twig->render('@Potage/Mail/bodyMail.html.twig', array( $twig->render('@Potage/Mail/bodyMail.html.twig', array(
'body' => $body, 'body' => $body,
'name' => 'coucou' 'to' => $to,
'subject' => $subject
)), )),
'text/html' '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