On rajoute le reply_to

This commit is contained in:
Tom Hubrecht 2021-06-20 09:00:28 +02:00
parent d975792cde
commit 867f8f86d6
3 changed files with 5 additions and 3 deletions

View file

@ -5,9 +5,9 @@ from .utils import send_mail
@shared_task
def send_election_mail(election_pk, subject, body):
def send_election_mail(election_pk, subject, body, reply_to):
election = Election.objects.get(pk=election_pk)
send_mail(election, subject, body)
send_mail(election, subject, body, reply_to)
election.sent_mail = False
election.save()
# election.sent_mail = True

View file

@ -379,7 +379,7 @@ def check_csv(csv_file):
return errors
def send_mail(election, subject, body):
def send_mail(election, subject, body, reply_to):
"""Envoie le mail d'annonce de l'élection avec identifiants et mot de passe
aux votant·e·s, le mdp est généré en même temps que le mail est envoyé.
"""
@ -404,6 +404,7 @@ def send_mail(election, subject, body):
password=password,
),
to=[v.email],
reply_to=[reply_to],
),
v,
)

View file

@ -190,6 +190,7 @@ class ElectionMailVotersView(CreatorOnlyEditMixin, SuccessMessageMixin, FormView
"election_pk": self.object.pk,
"subject": form.cleaned_data["objet"],
"body": form.cleaned_data["message"],
"reply_to": self.request.user.email,
},
)
return super().form_valid(form)