settings: ne pas définir SITE_ID
[auf_framonde.git] / project / contact / forms.py
1 from django import forms
2 from django.core.mail import EmailMessage
3 from django.template.loader import render_to_string
4
5
6 class ContactForm(forms.Form):
7 email = forms.EmailField()
8 subject = forms.CharField()
9 content = forms.CharField(widget=forms.Textarea())
10
11 def send(self, site_email):
12 email_message = EmailMessage(
13 self.cleaned_data['subject'],
14 render_to_string("email.txt", {
15 'data': self.cleaned_data,
16 }),
17 site_email,
18 [site_email],
19 headers={
20 'Reply-To': self.cleaned_data['email']
21 },)
22 email_message.send(fail_silently=True)