Browse Source

fix email template

Olivier Massot 3 years ago
parent
commit
4391fa3a19

+ 3 - 3
src/Service/MailHub.php

@@ -37,16 +37,16 @@ class MailHub
             throw new \RuntimeException('Access has no principal email address, abort');
         }
         /** @noinspection NullPointerExceptionInspection */
-        $to = new Address($contactPoint->getEmail(), $access->getPerson()->getFullName());
+        $to = new Address($contactPoint->getEmail(), $access->getPerson()->getFullName() ?? $access->getPerson()->getUsername());
 
-        $context = ['_address' => $to];
+        $context = ['_to' => $to];
         $context = array_merge($context, $data);
 
         $email = (new TemplatedEmail())
             ->from($this->opentalentNoReplyEmailAddress)
             ->to($to)
             ->subject($subject)
-            ->htmlTemplate('@templates/mail/' . $template . '.html.twig')
+            ->htmlTemplate('@templates/emails/' . $template . '.html.twig')
             ->context($context);
 
         $this->mailer->send($email);

+ 1 - 1
templates/emails/subdomain.html.twig

@@ -14,4 +14,4 @@ Notez que votre identifiant est désormais : {{access.person.username}}
 Votre mot de passe reste inchangé.
 {% endif %}
 
-{% include 'signature_opentalent.html.twig' with {'name': _address.fullname, 'email': _address.email } only %}
+{% include '@templates/layout/noreply/footer.html.twig' with {'name': _to.name, 'email': _to.address } only %}

+ 6 - 0
templates/layout/noreply/footer.html.twig

@@ -0,0 +1,6 @@
+Merci !<br>
+L'équipe Opentalent<br>
+<hr/>
+<em>Cet e-mail a été envoyé automatiquement. Merci de ne pas y répondre.<br>
+    Cet e-mail a été adressé à :<br>
+    {{name}} <{{email}}></em>