mail processing confirmation uses template
This commit is contained in:
@@ -33,25 +33,23 @@ queuelow = django_rq.get_queue('low')
|
||||
queuehigh = django_rq.get_queue('default')
|
||||
|
||||
# Sends a confirmation with a link to the workout
|
||||
|
||||
from rowers.emails import send_template_email
|
||||
|
||||
def send_confirm(user, name, link, options):
|
||||
""" Send confirmation email to user when email has been processed """
|
||||
d = {
|
||||
'first_name':user.first_name,
|
||||
'name':name,
|
||||
'link':link,
|
||||
}
|
||||
|
||||
fullemail = user.email
|
||||
subject = 'Workout added: ' + name
|
||||
message = 'Dear ' + user.first_name + ',\n\n'
|
||||
message += "Your workout has been added to Rowsandall.com.\n"
|
||||
message += "Link to workout: " + link + "\n\n"
|
||||
message += "Best Regards, the Rowsandall Team"
|
||||
|
||||
if options:
|
||||
message += "\n\n" + str(options)
|
||||
|
||||
email = EmailMessage(subject, message,
|
||||
'Rowsandall <info@rowsandall.com>',
|
||||
[fullemail])
|
||||
|
||||
res = email.send()
|
||||
subject = 'New Workout Added: '+name
|
||||
|
||||
res = send_template_email('Rowsandall <info@rowsandall.com>',
|
||||
[fullemail],
|
||||
subject,'confirmemail.html',
|
||||
d
|
||||
)
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -83,8 +83,12 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
||||
plottype, title,
|
||||
imagename=imagename
|
||||
)
|
||||
email_sent = send_confirm(
|
||||
rower.user, title, link,
|
||||
uploadoptions
|
||||
)
|
||||
try:
|
||||
if workoutid and not testing:
|
||||
if workoutid:
|
||||
email_sent = send_confirm(
|
||||
rower.user, title, link,
|
||||
uploadoptions
|
||||
@@ -92,13 +96,12 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
||||
time.sleep(10)
|
||||
except:
|
||||
try:
|
||||
if not testing:
|
||||
time.sleep(10)
|
||||
if workoutid:
|
||||
email_sent = send_confirm(
|
||||
rower.user, title, link,
|
||||
uploadoptions
|
||||
)
|
||||
time.sleep(10)
|
||||
if workoutid:
|
||||
email_sent = send_confirm(
|
||||
rower.user, title, link,
|
||||
uploadoptions
|
||||
)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
18
rowers/templates/confirmemail.html
Normal file
18
rowers/templates/confirmemail.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% extends "emailbase.html" %}
|
||||
|
||||
{% block body %}
|
||||
<p>Dear <strong>{{ first_name }}</strong>,</p>
|
||||
|
||||
<p>
|
||||
Your workout has been added to Rowsandall.com.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Link to workout: {{ link }}
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
Best Regards, the Rowsandall Team
|
||||
</p>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user