Skip to content

Commit

Permalink
Provide clean versions of text emails
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Nov 21, 2024
1 parent 44122d0 commit 9d07e40
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/MessageHandler/SendMessageEmailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function __invoke(SendMessageEmail $data): void
'content' => $content,
]);
$email->htmlTemplate('emails/message.html.twig');
$email->textTemplate('emails/message.txt.twig');

foreach ($message->getMessageDocuments() as $messageDocument) {
$filepath = $this->messageDocumentStorage->getPathname($messageDocument);
Expand Down
1 change: 1 addition & 0 deletions src/MessageHandler/SendReceiptEmailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function __invoke(Message\SendReceiptEmail $data): void
'subject' => $subject,
]);
$email->htmlTemplate('emails/receipt.html.twig');
$email->textTemplate('emails/receipt.txt.twig');

$sentEmail = $this->transportInterface->send($email);

Expand Down
1 change: 1 addition & 0 deletions src/MessageHandler/SendResetPasswordEmailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function __invoke(Message\SendResetPasswordEmail $data): void
'token' => $resetToken,
]);
$email->htmlTemplate('emails/reset_password.html.twig');
$email->textTemplate('emails/reset_password.txt.twig');

$this->transportInterface->send($email);
}
Expand Down
11 changes: 11 additions & 0 deletions templates/emails/message.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{#
# This file is part of Bileto.
# Copyright 2022-2024 Probesys
# SPDX-License-Identifier: AGPL-3.0-or-later
#}

{{ content | striptags }}

--
{{ 'emails.message.reply_txt' | trans({ url: url('ticket', { uid: ticket.uid }) }) }}
{{ 'emails.message.receiving' | trans({ ticketType: ticket.type }) }}
11 changes: 11 additions & 0 deletions templates/emails/receipt.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{#
# This file is part of Bileto.
# Copyright 2022-2024 Probesys
# SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% extends 'emails/transactional.txt.twig' %}

{% block body %}
{{ 'emails.receipt.received' | trans }}
{% endblock %}
15 changes: 15 additions & 0 deletions templates/emails/reset_password.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{#
# This file is part of Bileto.
# Copyright 2022-2024 Probesys
# SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% extends 'emails/transactional.txt.twig' %}

{% block body %}
{{ 'emails.reset_password.intro' | trans }}

{{ 'emails.reset_password.reset' | trans }} {{ url('edit password', { token: token.value }) }}

{{ 'emails.reset_password.expiration' | trans }}
{% endblock %}
18 changes: 18 additions & 0 deletions templates/emails/transactional.txt.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{#
# This file is part of Bileto.
# Copyright 2022-2024 Probesys
# SPDX-License-Identifier: AGPL-3.0-or-later
#}

{{ 'emails.politeness.hello' | trans }}

{% block body %}
{% endblock %}

{{ 'emails.politeness.regards' | trans }}
{{ 'emails.politeness.support_team' | trans }}

{% block footer %}
--
{{ 'emails.transactional.sent_txt' | trans({ url: url('home') }) | raw }}
{% endblock %}
2 changes: 2 additions & 0 deletions translations/messages+intl-icu.en_GB.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ contracts.status.finished: Finished
contracts.status.ongoing: Ongoing
emails.message.receiving: 'You are receiving this email because you are concerned by this { ticketType, select, request {request} incident {incident} other {} }.'
emails.message.reply: 'Reply to this email directly or <a href="{url}">view it on Bileto</a>.'
emails.message.reply_txt: 'Reply to this email directly or view it on Bileto: {url}'
emails.politeness.hello: 'Hello,'
emails.politeness.regards: 'Best regards,'
emails.politeness.support_team: 'The support team'
Expand All @@ -128,6 +129,7 @@ emails.reset_password.intro: 'You are receiving this email because a password re
emails.reset_password.reset: 'Reset your password'
emails.reset_password.subject: 'Reset your Bileto password'
emails.transactional.sent: 'This email has been sent by <a href="{url}">Bileto</a>.'
emails.transactional.sent_txt: 'This email has been sent by Bileto: {url}'
errors.404.description: 'The requested page couldn’t be located. Checkout for any URL misspelling.'
errors.404.title: 'Page not found!'
errors.back_home: 'Back to the homepage'
Expand Down
2 changes: 2 additions & 0 deletions translations/messages+intl-icu.fr_FR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ contracts.status.finished: Terminé
contracts.status.ongoing: 'En cours'
emails.message.receiving: 'Vous recevez cet email car vous êtes concerné par { ticketType, select, request {cette demande} incident {cet incident} other {} }.'
emails.message.reply: 'Répondez à cet email directement ou <a href="{url}">consultez-le dans Bileto</a>.'
emails.message.reply_txt: 'Répondez à cet email directement ou consultez-le dans Bileto : {url}'
emails.politeness.hello: 'Bonjour,'
emails.politeness.regards: 'Cordialement,'
emails.politeness.support_team: 'L’équipe support'
Expand All @@ -128,6 +129,7 @@ emails.reset_password.intro: 'Vous recevez cet email car une demande de réinial
emails.reset_password.reset: 'Réinitialiser votre mot de passe'
emails.reset_password.subject: 'Réinitialisez votre mot de passe Bileto'
emails.transactional.sent: 'Cet email a été envoyé par <a href="{url}">Bileto</a>.'
emails.transactional.sent_txt: 'Cet email a été envoyé par Bileto : {url}'
errors.404.description: 'La page demandée n’a pas été trouvée. Vérifiez qu’il n’y a pas de faute dans l’URL.'
errors.404.title: "Page non trouvée\_!"
errors.back_home: 'Retour à la page d’accueil'
Expand Down

0 comments on commit 9d07e40

Please sign in to comment.