fix e-mail templates
This commit is contained in:
parent
7b042303a8
commit
8aa54922b7
4 changed files with 26 additions and 17 deletions
|
@ -1,5 +1,7 @@
|
||||||
{{name}} <{{email}}> sent a contact message:
|
From: {{name}} <{{email}}>
|
||||||
|
Subject: {{subject}}
|
||||||
|
|
||||||
{{message}}
|
{{message}}
|
||||||
|
|
||||||
--
|
--
|
||||||
{{sitename}}
|
{{sitename}} - {{url}}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{{name}},
|
From: {{name}} <{{from}}>
|
||||||
thanks for your message, we will get back to you shortly.
|
To: {{sitename}} <{{to}}>
|
||||||
here your message for forther reference
|
Subject: {{subject}}
|
||||||
|
|
||||||
{{message}}
|
{{message}}
|
||||||
|
|
||||||
--
|
--
|
||||||
{{sitename}}
|
{{sitename}} - {{url}}
|
||||||
|
|
|
@ -2,6 +2,7 @@ To reset your password, please use the following code:
|
||||||
|
|
||||||
{{code}}
|
{{code}}
|
||||||
|
|
||||||
If you do not want to reset your password, no further action is required.
|
If you don't want to reset your password, no further action is required.
|
||||||
|
|
||||||
|
--
|
||||||
{{sitename}} - {{url}}
|
{{sitename}} - {{url}}
|
||||||
|
|
|
@ -278,9 +278,9 @@ def requestToken(request):
|
||||||
|
|
||||||
template = loader.get_template('password_reset_email.txt')
|
template = loader.get_template('password_reset_email.txt')
|
||||||
context = RequestContext(request, {
|
context = RequestContext(request, {
|
||||||
'url': request.build_absolute_uri("/"),
|
|
||||||
'code': code,
|
'code': code,
|
||||||
'sitename': settings.SITENAME,
|
'sitename': settings.SITENAME,
|
||||||
|
'url': request.build_absolute_uri('/'),
|
||||||
})
|
})
|
||||||
message = template.render(context)
|
message = template.render(context)
|
||||||
subject = '%s - Reset Password' % settings.SITENAME
|
subject = '%s - Reset Password' % settings.SITENAME
|
||||||
|
@ -548,18 +548,20 @@ def contact(request):
|
||||||
if 'message' in data and data['message'].strip():
|
if 'message' in data and data['message'].strip():
|
||||||
email_from = settings.CONFIG['site']['email']['system']
|
email_from = settings.CONFIG['site']['email']['system']
|
||||||
email_to = [settings.CONFIG['site']['email']['contact'], ]
|
email_to = [settings.CONFIG['site']['email']['contact'], ]
|
||||||
|
subject = data.get('subject', '').strip()
|
||||||
template = loader.get_template('contact_email.txt')
|
template = loader.get_template('contact_email.txt')
|
||||||
context = RequestContext(request, {
|
context = RequestContext(request, {
|
||||||
'email': email,
|
|
||||||
'message': data['message'].strip(),
|
|
||||||
'name': name,
|
'name': name,
|
||||||
|
'email': email,
|
||||||
|
'subject': subject
|
||||||
|
'message': data['message'].strip(),
|
||||||
'sitename': settings.SITENAME,
|
'sitename': settings.SITENAME,
|
||||||
|
'url': request.build_absolute_uri('/'),
|
||||||
})
|
})
|
||||||
message = template.render(context)
|
message = template.render(context)
|
||||||
subject = (u'[%s Contact] %s' % (settings.SITENAME, data.get('subject', ''))).strip()
|
|
||||||
response = json_response(text='message sent')
|
response = json_response(text='message sent')
|
||||||
try:
|
try:
|
||||||
send_mail(subject.strip(), message, email_from, email_to)
|
send_mail(u'[%s Contact] %s' % (settings.SITENAME, subject), message, email_from, email_to)
|
||||||
except BadHeaderError:
|
except BadHeaderError:
|
||||||
response = json_response(status=400, text='invalid data')
|
response = json_response(status=400, text='invalid data')
|
||||||
if request.user.is_authenticated() \
|
if request.user.is_authenticated() \
|
||||||
|
@ -567,14 +569,17 @@ def contact(request):
|
||||||
and data['receipt']:
|
and data['receipt']:
|
||||||
template = loader.get_template('contact_receipt.txt')
|
template = loader.get_template('contact_receipt.txt')
|
||||||
context = RequestContext(request, {
|
context = RequestContext(request, {
|
||||||
'email': email,
|
|
||||||
'message': data['message'].strip(),
|
|
||||||
'name': name,
|
'name': name,
|
||||||
|
'from': email,
|
||||||
'sitename': settings.SITENAME,
|
'sitename': settings.SITENAME,
|
||||||
|
'to': email_to,
|
||||||
|
'subject': subject,
|
||||||
|
'message': data['message'].strip(),
|
||||||
|
'url': request.build_absolute_uri('/'),
|
||||||
})
|
})
|
||||||
message = template.render(context)
|
message = template.render(context)
|
||||||
try:
|
try:
|
||||||
send_mail(subject.strip(), message, email_from, [email])
|
send_mail('Fwd: %s' % subject, message, email_from, [email])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue