Browse Source

use template for sending mail

master
Benni Baermann 4 years ago
parent
commit
ae82a26ba8
2 changed files with 6 additions and 1 deletions
  1. +1
    -0
      input/templates/input/ifg_volunteer_mail.txt
  2. +5
    -1
      input/views.py

+ 1
- 0
input/templates/input/ifg_volunteer_mail.txt View File

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

+ 5
- 1
input/views.py View File

@ -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…
Cancel
Save