From ae82a26ba8ea23ea7041bc6b91f51dd2e4b61143 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 7 Oct 2020 15:07:02 +0200 Subject: [PATCH] use template for sending mail --- input/templates/input/ifg_volunteer_mail.txt | 1 + input/views.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 input/templates/input/ifg_volunteer_mail.txt diff --git a/input/templates/input/ifg_volunteer_mail.txt b/input/templates/input/ifg_volunteer_mail.txt new file mode 100644 index 0000000..0ec22aa --- /dev/null +++ b/input/templates/input/ifg_volunteer_mail.txt @@ -0,0 +1 @@ +hello {{realname}} diff --git a/input/views.py b/input/views.py index d5c9625..a4df71a 100644 --- a/input/views.py +++ b/input/views.py @@ -4,6 +4,8 @@ from django.http import HttpResponse from formtools.wizard.views import CookieWizardView from django.core.mail import send_mail from django.conf import settings +from django.template.loader import get_template +from django.template import Context from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm from .models import Project @@ -88,9 +90,11 @@ class ExternView(CookieWizardView): # we need to send the following mails here: # - mail with entered data to the Volunteer + mail_template = get_template('input/ifg_volunteer_mail.txt') + context = { 'realname': data['realname'] } send_mail( 'form filled', - 'you are such a great form filler!', + mail_template.render(context), settings.IF_EMAIL, [form.email], fail_silently=False,