Skip to content

Commit

Permalink
Add support for html mails
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Jul 2, 2021
1 parent fa7aea9 commit 6935ab9
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Mailer/Mail/RegistrationMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function __construct(Headers $headers = null, AbstractPart $body = null)
{
parent::__construct($headers, $body);

$this->htmlTemplate('@NucleosProfile/Registration/email.txt.twig');
$this->textTemplate('@NucleosProfile/Registration/email.txt.twig');
$this->htmlTemplate('@NucleosProfile/Registration/email.html.twig');
}

public function setConfirmationUrl(string $confirmationUrl): self
Expand Down
7 changes: 7 additions & 0 deletions src/Resources/translations/NucleosProfileBundle.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ registration:
Mit besten Grüßen,
das Team.
html: |
<p>Hallo %username%!</p>
<p>Besuchen Sie bitte folgende Seite, um Ihr Benutzerkonto zu bestätigen: <a href="%confirmationUrl%">%confirmationUrl%</a></p>
<p>Mit besten Grüßen,</p>
<p>das Team.</p>
form:
group_name: Gruppenname
username: Benutzername
Expand Down
9 changes: 9 additions & 0 deletions src/Resources/translations/NucleosProfileBundle.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ registration:
Regards,
the Team.
html: |
<p>Hello %username%!</p>
<p>To finish activating your account - please visit <a href="%confirmationUrl%">%confirmationUrl%</a></p>
<p>This link can only be used once to validate your account.</p>
<p>Regards,</p>
<p>the Team.</p>
form:
group_name: 'Group name'
username: Username
Expand Down
9 changes: 9 additions & 0 deletions src/Resources/translations/NucleosProfileBundle.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ registration:
Atentamente,
el equipo.
html: |
<p>¡Hola %username%!</p>
<p>Para completar la validación de tu cuenta, por favor visita <a href="%confirmationUrl%">%confirmationUrl%</a></p>
<p>Este enlace sólo puede utilizarse una vez para validar tu cuenta.</p>
<p>Atentamente,</p>
<p>el equipo.</p>
form:
group_name: Nombre de grupo
username: Nombre de usuario
Expand Down
10 changes: 10 additions & 0 deletions src/Resources/translations/NucleosProfileBundle.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ registration:
Cordialement,
l'équipe.
html: |
<p>Bonjour %username% !</p>
<p>Pour activer définitivement votre compte, merci de visiter la page <a href="%confirmationUrl%">%confirmationUrl%</a></p>
<p>Ce lien ne peut être utilisé qu'une seule fois pour valider votre compte.</p>
<p>Cordialement,</p>
<p>l'équipe.</p>
form:
group_name: 'Nom du groupe'
username: Nom d'utilisateur
Expand Down
6 changes: 6 additions & 0 deletions src/Resources/views/Registration/email.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% trans_default_domain 'NucleosProfileBundle' %}

{{ 'registration.email.html'|trans({
'%username%': user.username,
'%confirmationUrl%': confirmationUrl
})|raw }}

0 comments on commit 6935ab9

Please sign in to comment.