use template for sending mail
This commit is contained in:
parent
6ddc55e287
commit
ae82a26ba8
2 changed files with 6 additions and 1 deletions
1
input/templates/input/ifg_volunteer_mail.txt
Normal file
1
input/templates/input/ifg_volunteer_mail.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
hello {{realname}}
|
|
@ -4,6 +4,8 @@ from django.http import HttpResponse
|
||||||
from formtools.wizard.views import CookieWizardView
|
from formtools.wizard.views import CookieWizardView
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.conf import settings
|
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 .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm
|
||||||
from .models import Project
|
from .models import Project
|
||||||
|
@ -88,9 +90,11 @@ class ExternView(CookieWizardView):
|
||||||
|
|
||||||
# we need to send the following mails here:
|
# we need to send the following mails here:
|
||||||
# - mail with entered data to the Volunteer
|
# - mail with entered data to the Volunteer
|
||||||
|
mail_template = get_template('input/ifg_volunteer_mail.txt')
|
||||||
|
context = { 'realname': data['realname'] }
|
||||||
send_mail(
|
send_mail(
|
||||||
'form filled',
|
'form filled',
|
||||||
'you are such a great form filler!',
|
mail_template.render(context),
|
||||||
settings.IF_EMAIL,
|
settings.IF_EMAIL,
|
||||||
[form.email],
|
[form.email],
|
||||||
fail_silently=False,
|
fail_silently=False,
|
||||||
|
|
Loading…
Reference in a new issue