From 9f8467bdb234718c4ea252826725675f7a565c13 Mon Sep 17 00:00:00 2001 From: Yasin Date: Fri, 29 Aug 2014 15:23:16 +0200 Subject: [PATCH] slice req validate email: updated template and text --- portal/actions.py | 21 ++++++++++++++++--- portal/templates/slice_request_validated.html | 20 ++++++++++++++++++ portal/templates/slice_request_validated.txt | 18 ++++++++++++++++ 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 portal/templates/slice_request_validated.html create mode 100644 portal/templates/slice_request_validated.txt diff --git a/portal/actions.py b/portal/actions.py index d4bc8ea7..d95a78ee 100644 --- a/portal/actions.py +++ b/portal/actions.py @@ -548,9 +548,24 @@ def create_slice(wsgi_request, request): raise Exception, "Could not create %s. Already exists ?" % slice_params['hrn'] else: clear_user_creds(wsgi_request,user_email) - subject = 'Slice created' - msg = 'A manager of your institution has validated your slice request. You can now add resources to the slice and start experimenting.' - send_mail(subject, msg, 'support@onelab.eu',[user_email], fail_silently=False) + + try: + theme.template_name = 'slice_request_validated.txt' + text_content = render_to_string(theme.template, request) + theme.template_name = 'slice_request_validated.html' + html_content = render_to_string(theme.template, request) + + theme.template_name = 'email_default_sender.txt' + sender = render_to_string(theme.template, request) + sender = sender.replace('\n', '') + + subject = 'Slice request validated' + + msg = EmailMultiAlternatives(subject, text_content, sender, [user_email]) + msg.attach_alternative(html_content, "text/html") + msg.send() + except Exception, e: + print "Failed to send email, please check the mail templates and the SMTP configuration of your server" return results diff --git a/portal/templates/slice_request_validated.html b/portal/templates/slice_request_validated.html new file mode 100644 index 00000000..9c18227c --- /dev/null +++ b/portal/templates/slice_request_validated.html @@ -0,0 +1,20 @@ + +
+

Dear OneLab user,

+

+

You have recently requested a slice in the OneLab portal.

+
+Slice name : {{slice_name}}
+URL : {{number_of_nodes}}
+Purpose : {{purpose}}
+

+

We are glad to inform you that, a manager of your institution has validated your slice request. You can now add resources to the slice and start experimenting.

+

+

On behalf of the entire team, I wish you a fruitful user experience on OneLab.

+

+

Yours sincerely,

+ +

Timur Friedman

+

Executive Director

+ + diff --git a/portal/templates/slice_request_validated.txt b/portal/templates/slice_request_validated.txt new file mode 100644 index 00000000..f0cd3c5c --- /dev/null +++ b/portal/templates/slice_request_validated.txt @@ -0,0 +1,18 @@ +Dear OneLab user, + +You have recently requested a slice in the OneLab portal. + +Slice name : {{slice_name}} +URL : {{number_of_nodes}} +Purpose : {{purpose}} + +We are glad to inform you that, a manager of your institution has validated your slice request. You can now add resources to the slice and start experimenting. + +On behalf of the entire team, I wish you a fruitful user experience on OneLab. + +Yours sincerely, + +Timur Friedman +Executive Director + + -- 2.43.0