from email removed direct dependency from post request
This commit is contained in:
parent
3e6084a1b1
commit
7410a73e60
1 changed files with 6 additions and 3 deletions
|
@ -49,15 +49,18 @@ class ContactUsView(FormView):
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.save()
|
form.save()
|
||||||
|
from_emails = {
|
||||||
|
'glasfaser': 'glasfaser@ungleich.ch'
|
||||||
|
}
|
||||||
|
from_page = self.request.POST.get('from_page')
|
||||||
|
print(from_emails.get(from_page, 'info@ungleich.ch'))
|
||||||
email_data = {
|
email_data = {
|
||||||
'subject': "{dcl_text} Message from {sender}".format(
|
'subject': "{dcl_text} Message from {sender}".format(
|
||||||
dcl_text=settings.DCL_TEXT,
|
dcl_text=settings.DCL_TEXT,
|
||||||
sender=form.cleaned_data.get('email')
|
sender=form.cleaned_data.get('email')
|
||||||
),
|
),
|
||||||
'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
|
'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
|
||||||
'to': '{}@ungleich.ch'.format(
|
'to': from_emails.get(from_page, 'info@ungleich.ch'),
|
||||||
self.request.POST.get('from_page', 'info')
|
|
||||||
),
|
|
||||||
'body': "\n".join(
|
'body': "\n".join(
|
||||||
["%s=%s" % (k, v) for (k, v) in form.cleaned_data.items()]),
|
["%s=%s" % (k, v) for (k, v) in form.cleaned_data.items()]),
|
||||||
'reply_to': [form.cleaned_data.get('email')],
|
'reply_to': [form.cleaned_data.get('email')],
|
||||||
|
|
Loading…
Reference in a new issue