archives: correction du texte pour Amélie
[auf_framonde.git] / project / contact / forms.py
CommitLineData
01b54c21
MN
1from django import forms
2from django.core.mail import EmailMessage
3from django.template.loader import render_to_string
4
6837e829 5
01b54c21 6class ContactForm(forms.Form):
6837e829
PH
7 email = forms.EmailField()
8 subject = forms.CharField()
9 content = forms.CharField(widget=forms.Textarea())
01b54c21 10
6837e829
PH
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)