X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Factions.py;h=ea87918f6c5988036ffde2fc39564761442185a6;hb=1b585d116ff4ec2538326740c36562735ea25ff6;hp=3fed09d6381b71ffb36c2642edf9dec2a8a233e6;hpb=89e110988e41911ddfe064ceb0e591b7fbeffeab;p=myslice.git diff --git a/portal/actions.py b/portal/actions.py index 3fed09d6..ea87918f 100644 --- a/portal/actions.py +++ b/portal/actions.py @@ -654,9 +654,25 @@ def sfa_create_user(wsgi_request, request, namespace = None, as_admin = False): if not results: raise Exception, "Could not create %s. Already exists ?" % sfa_user_params['user_hrn'] else: - subject = 'User validated' - msg = 'A manager of your institution has validated your account. You have now full user access to the portal.' - send_mail(subject, msg, 'support@onelab.eu',[request['email']], fail_silently=False) + try: + theme.template_name = 'user_request_validated.txt' + text_content = render_to_string(theme.template, request) + theme.template_name = 'user_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 = 'User validated' + + msg = EmailMultiAlternatives(subject, text_content, sender, [request['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 def create_user(wsgi_request, request, namespace = None, as_admin = False):