fixing contact form
This commit is contained in:
24
rowers/templates/contactformemail.html
Normal file
24
rowers/templates/contactformemail.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{% extends "emailbase.html" %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<p>New Contact Form Message</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
From: {{ firstname }} {{ lastname }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Email: {{ email }}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Subject: {{ subject }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ message }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Best Regards, the Rowsandall Team
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
@@ -1290,11 +1290,24 @@ def sendmail(request):
|
|||||||
subject = 'Rowsandall Contact Form:'+form.cleaned_data['subject']
|
subject = 'Rowsandall Contact Form:'+form.cleaned_data['subject']
|
||||||
message = form.cleaned_data['message']
|
message = form.cleaned_data['message']
|
||||||
fullemail = firstname + " " + lastname + " " + "<" + email + ">"
|
fullemail = firstname + " " + lastname + " " + "<" + email + ">"
|
||||||
try:
|
d = {
|
||||||
send_mail(subject, message, fullemail, ['info@rowsandall.com'])
|
'firstname': firstname,
|
||||||
except:
|
'lastname': lastname,
|
||||||
|
'email': email,
|
||||||
|
'subject': subject,
|
||||||
|
'message': message,
|
||||||
|
}
|
||||||
|
res = send_template_email('Rowsandall <info@rowsandall.com>',
|
||||||
|
['Rowsandall <info@rowsandall.com>'],
|
||||||
|
subject,
|
||||||
|
'contactformemail.html',
|
||||||
|
d
|
||||||
|
)
|
||||||
|
if res:
|
||||||
|
messages.info(request,"Your contact form was submitted")
|
||||||
|
else:
|
||||||
messages.error(
|
messages.error(
|
||||||
request, "Something went wrong trying to send the email")
|
request, "Something went wrong trying to send the form")
|
||||||
return HttpResponseRedirect('/rowers/email/thankyou/')
|
return HttpResponseRedirect('/rowers/email/thankyou/')
|
||||||
else:
|
else:
|
||||||
if not success:
|
if not success:
|
||||||
|
|||||||
Reference in New Issue
Block a user