changed email in alplora contact form
This commit is contained in:
parent
25e3b7e888
commit
a451c96271
2 changed files with 42 additions and 42 deletions
|
@ -26,7 +26,7 @@ class IndexView(FormView):
|
|||
|
||||
def form_valid(self, form):
|
||||
form.save()
|
||||
form.send_email()
|
||||
form.send_email(email_to='info@alplora.ch')
|
||||
messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
||||
return super(IndexView, self).form_valid(form)
|
||||
|
||||
|
|
|
@ -145,10 +145,10 @@ class ContactUsForm(forms.ModelForm):
|
|||
'message': _('Message'),
|
||||
}
|
||||
|
||||
def send_email(self):
|
||||
def send_email(self, email_to='info@digitalglarus.ch'):
|
||||
text_content = render_to_string('emails/contact.txt', {'data': self.cleaned_data})
|
||||
html_content = render_to_string('emails/contact.html', {'data': self.cleaned_data})
|
||||
email = EmailMultiAlternatives('Subject', text_content)
|
||||
email.attach_alternative(html_content, "text/html")
|
||||
email.to = ['info@digitalglarus.ch']
|
||||
email.to = [email_to]
|
||||
email.send()
|
||||
|
|
Loading…
Reference in a new issue