1
0
Fork 0

use template for sending mail

This commit is contained in:
Benni Bärmann 2020-10-07 15:07:02 +02:00
parent 6ddc55e287
commit ae82a26ba8
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1 @@
hello {{realname}}

View File

@ -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,