Commit a8e9834a authored by senza's avatar senza
Browse files

bugfix: anotate team email when empty && make email come from user

parent 88a8ceda
Loading
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -580,8 +580,8 @@ def send_email_on_contacteo(sender, instance, created, **kwargs):
@receiver(post_save, sender=HomePageElectedOfficals)
def send_email_on_HomePageElectedOfficals(sender, instance, created, **kwargs):
    if created:
        teamEmail = "community@free-the-tree.org"
        key = ['key0','From']
        #teamEmail = "test@test.com"
        key = [' ','De la part ']
        body = {
            key[0] : instance.emailContent,
            key[1] : instance.firstname + " " + instance.lastname,
@@ -593,9 +593,11 @@ def send_email_on_HomePageElectedOfficals(sender, instance, created, **kwargs):
        email = EmailMessage(
            instance.emailSubject + " " + instance.firstname + " "+ instance.lastname,
            content,
            instance.userEmail,#here is from value
            to=[instance.electedEmails],
            cc=[instance.userEmail,teamEmail],
            reply_to=[instance.userEmail,teamEmail],
            cc=[instance.userEmail],
            reply_to=[instance.userEmail],
            #from=[instance.userEmail],
        )
        #email.attach_file('./static/img/ATTESTATION-DE-SORTIE-DE-CRISE-DÉROGATOIRE.pdf')
        email.send()