From 21cfd509721cb46c0a68238a1355e4d3b8998138 Mon Sep 17 00:00:00 2001 From: corsaronero Date: Thu, 17 Nov 2022 18:45:45 +0000 Subject: [PATCH] sendmails is sending html regarding the informing of the organisator when not happened --- input/management/commands/sendmails.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/input/management/commands/sendmails.py b/input/management/commands/sendmails.py index 243c396..fe4b471 100644 --- a/input/management/commands/sendmails.py +++ b/input/management/commands/sendmails.py @@ -115,8 +115,9 @@ class Command(BaseCommand): html_mail_template = get_template('input/if_not_of_project_approved.html') txt_mail_template = get_template('input/if_not_of_project_approved.txt') - informMail_template = get_template('input/if_end_of_project_orginformed.txt') - + + txt_informMail_template = get_template('input/if_end_of_project_orginformed.txt') + html_informMail_template = get_template('input/if_end_of_project_orginformed.html') # send the mail to project.email, which would be the mail of the volunteer that filled out the form for project in approved_notHappened: @@ -137,11 +138,19 @@ class Command(BaseCommand): # IF_EMAIL, # [project.email], # fail_silently=False) - send_mail('Projektorganisator*in wurde informiert', - informMail_template.render(context), - IF_EMAIL, - [IF_EMAIL], - fail_silently=False) + + inform_subject, inform_from_email, inform_to = Projektorganisator*in wurde informiert', IF_EMAIL, IF_EMAIL + inform_text_content = txt_informMail_template.render(context) + inform_html_content = html_informMail_template.render(context) + inform_msg = EmailMultiAlternatives(inform_subject, inform_text_content, inform_from_email, [inform_to]) + inform_msg.attach_alternative(html_content, "text/html") + inform_msg.send() + + #send_mail('Projektorganisator*in wurde informiert', + # informMail_template.render(context), + # IF_EMAIL, + # [IF_EMAIL], + # fail_silently=False) project.end_mail_send = True project.save()