up mail templates

This commit is contained in:
Tykayn 2021-05-18 23:26:33 +02:00 committed by tykayn
parent 03cba297d5
commit 9a1b8c90a4
10 changed files with 512 additions and 470 deletions

View File

@ -0,0 +1,8 @@
# config/packages/dev/mailer.yaml
framework:
mailer:
envelope:
sender: 'noreply@tktest.com'
recipients: ['tykayn@pm.me']
headers:
from: 'dev framadate funky <noreply@tktest.com>'

View File

@ -9,7 +9,6 @@ use Swift_Mailer;
use Swift_Message;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
/**
* sending emails controller
*
@ -83,7 +82,7 @@ class EmailsController extends AbstractController {
$message = ( new Swift_Message( $config[ 'title' ] ) )
->setContentType( "text/html" )
->setCharset( 'UTF-8' )
->setFrom( [ 'ne-pas-repondre@framadate-api.cipherbliss.com' ] )
->setFrom( [ 'ne-pas-repondre@framadate-api.cipherbliss.com'] )
->setTo( [ $config[ 'owner' ]->getEmail() ] )
->setBody( $htmlbody, 'text/html' );

View File

@ -405,16 +405,23 @@ class PollController extends EmailsController {
$em = $this->getDoctrine()->getRepository( Owner::class );
$foundOwner = $em->findOneByEmail( $emailChoice );
if ( $foundOwner ) {
$poll = $foundOwner->getPolls()[ 0 ];
$comment = $foundOwner->getComments()[ 0 ];
$sent = $this->sendOwnerPollsAction( $foundOwner );
if ( $sent ) {
return $this->json( [ "message" => "test email sent to " . $foundOwner->getEmail() . "!" ], 200 );
$config = [
'owner' => $foundOwner,
'title' => $this->getParameter( 'WEBSITE_NAME' ) . ' | Mes sondages',
'email_template' => 'emails/owner-list.html.twig',
];
return $this->render( 'emails/owner-list.html.twig', $config );
// return $this->json( [ "message" => "test email sent to " . $foundOwner->getEmail() . "!" ], 200 );
}
}
return $this->json( [ "message" => "user with this email was not found" ], 400 );
// $this->sendMailWithVars( $config );
// return $this->json( [ "message" => "user with this email was not found" ], 400 );
}

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,12 @@
{% extends 'email-base.html.twig' %}
{% block content %}
Suite à la création de votre sondage {{ title }} vous recevez deux emails afin de ne pas transmettre par erreur aux sondés le lien d'administration de votre sondage.
<h1>✨ Création de votre sondage {{ title }} </h1>
Suite à la création de votre sondage <strong>{{ title }}</strong> vous recevez deux emails afin de ne pas transmettre par erreur aux sondés le lien d'administration de votre sondage.
<br>
Ce mail est le premier, comportant le message qui doit être envoyé aux sondés.<br>
Vous pouvez maintenant transmettre ce message à toutes les personnes susceptibles de participer au vote.<br>
Vous pouvez maintenant transmettre ce message à toutes les personnes susceptibles de participer au vote. ✔️ <br>
<br>
<fieldset>
@ -15,7 +15,7 @@
<blockquote>
<i>
{{ owner.pseudo }} ( {{ owner.email }} ) vient de créer un sondage intitulé : " <strong>{{ title }}
💡 {{ owner.pseudo }} ( {{ owner.email }} ) vient de créer un sondage intitulé : " <strong>{{ title }}
"</strong>.
<br>
<br>

View File

@ -3,13 +3,17 @@
{% block content %}
Ce sondage va bientôt expirer dans 1 jour, <br>
<h1> 🎌 Votre sondage {{ poll.title }} va bientôt expirer dans 1 jour,</h1>
<blockquote>
le {{ poll.expiracyDate | date('D Y-m-d') }}
le {{ poll.expiracyDate | date('D Y-m-d') }} :
</blockquote>
il ne sera plus possible d'y voter. <br>
Dans 31 jours il sera supprimé.<br>
Vous pouvez exporter ses données à tout moment en vous rendant à ce lien pour l'administrer:
<br>
{% include 'emails/partial/admin_link.html.twig' %}
<hr>
Plus de détails sur votre sondage :
{% include 'emails/partial/poll.html.twig' %}
{% endblock %}

View File

@ -13,10 +13,10 @@
<a href="https://framagit.org/framasoft/framadate/funky-framadate-front">
Sources du client Front end,
</a>
<a href="https://framagit.org/framasoft/framadate/framadate">
<a href="https://framagit.org/tykayn/date-poll-api">
API back end.
</a>
<a href="https://framagit.org/framasoft/framadate/funky-framadate-front/-/wikis/home">
<a href="https://framagit.org/framasoft/framadate/funky-framadate-front/docs">
Documentation
</a>

View File

@ -1,2 +1 @@
<a href="{{ BASE_URL }}/#/poll/{{ poll.id }}/admin/{{ poll.adminKey }}">{{ BASE_URL }}
/admin/{{ poll.adminKey }}</a>
<a href="{{ BASE_URL }}/#/poll/{{ poll.customUrl }}/admin/{{ poll.adminKey }}">{{ BASE_URL }}/#/poll/{{ poll.customUrl }}/admin/{{ poll.adminKey }}</a>

View File

@ -2,11 +2,9 @@
<h1>
Sondage {{ poll.title }}
</h1>
<br>
<div class="creation">
créé le {{ poll.creationDate| date('Y m d ') }}
créé le {{ poll.createdAt| date('Y m d ') }}
</div>
<div class="creation">
expirera le {{ poll.expiracyDate| date('Y m d ') }}
@ -18,22 +16,29 @@
{{ poll.comments |length }} commentaires
</span>
{% if poll.password |length %}
(accès avec mot de passe)
<div class="protected">
🔐 (accès avec mot de passe)
</div>
{% else %}
{% endif %}
{% if poll.isZeroKnowledge |length %}
<div class="protected-zero-knoledge">
🔐 Ce sondage bénéficie du chiffrement Zéro knowledge, nos administrateurs ne sont pas en mesure de connaître les informations du sondage.
</div>
{% else %}
{% endif %}
<br>
<div class="public">
<span>
<div>
lien à donner aux votants:
</span>
</div>
{% include 'emails/partial/public_link.html.twig' %}
</div>
<div class="admin">
<span>
<div>
administration:
</span>
</div>
{% include 'emails/partial/admin_link.html.twig' %}
</div>
</div>

View File

@ -1,11 +1,10 @@
<span class="public-link">
{% if poll.customUrl |length %}
<a href="{{ BASE_URL }}/#/vote/poll/key/{{ poll.customUrl }}">
{{ BASE_URL }}/#/vote/poll/key/{{ poll.customUrl }}
<a href="{{ BASE_URL }}/#/poll/{{ poll.customUrl }}/consultation">
✉️ {{ BASE_URL }}/#/poll/{{ poll.customUrl }}/consultation
</a>
{% else %}
<a href="{{ BASE_URL }}/#/vote/poll/id/{{ poll.id }}">
{{ BASE_URL }}/#/vote/poll/id/{{ poll.id }}
</a>
erreur, il manque la customUrl de ce sondage.
{% endif %}
</span>