- mail_body = render_to_string([
- 'contact/%s/mail_body.txt' % self.form_tag,
- 'contact/mail_body.txt',
- ], dictionary, context)
- send_mail(mail_subject, mail_body,
- 'no-reply@%s' % site.domain,
- [contact.contact],
- fail_silently=True)
+ if self.result_page:
+ mail_body = render_to_string(
+ 'contact/%s/results_email.txt' % contact.form_tag,
+ {
+ 'contact': contact,
+ 'results': self.results(contact),
+ }, context)
+ else:
+ mail_body = render_to_string([
+ 'contact/%s/mail_body.txt' % self.form_tag,
+ 'contact/mail_body.txt',
+ ], dictionary, context)
+ send_mail(mail_subject, mail_body, 'no-reply@%s' % site.domain, [contact.contact], fail_silently=True)
+ if self.mailing or (self.mailing_field and self.cleaned_data[self.mailing_field]):
+ email = self.cleaned_data['contact']
+ mailing.subscribe(email)