def mail_new_user(user):
 current_site = Site.objects.get_current()
 siteconfig = SiteConfiguration.objects.get_current()
 domain_method = siteconfig.get(u'site_domain_method')
 subject = (u'New Review Board user registration for %s' % user.username)
 from_email = build_email_address_for_user(user)
 context = {u'domain': current_site.domain, u'domain_method': domain_method, u'user': user, u'user_url': reverse(u'admin:auth_user_change', args=(user.id,))}
 text_message = render_to_string(u'notifications/new_user_email.txt', context)
 html_message = render_to_string(u'notifications/new_user_email.html', context)
 message = EmailMessage(subject=subject.strip(), text_body=text_message, html_body=html_message, from_email=settings.SERVER_EMAIL, sender=settings.SERVER_EMAIL, to=[build_email_address(full_name=admin[0], email=admin[1]) for admin in settings.ADMINS])
 try:
  message.send()
 except Exception as e:
  logging.error(u"Error sending e-mail notification with subject '%s' on behalf of '%s' to admin: %s", subject.strip(), from_email, e, exc_info=1)

def mail_new_user ( user ) : current_site = Site . objects . get_current ( ) siteconfig = SiteConfiguration . objects . get_current ( ) domain_method = siteconfig . get ( u'site_domain_method' ) subject = ( u'New Review Board user registration for %s' % user . username ) from_email = build_email_address_for_user ( user ) context = { u'domain' : current_site . domain , u'domain_method' : domain_method , u'user' : user , u'user_url' : reverse ( u'admin:auth_user_change' , args = ( user . id , ) ) } text_message = render_to_string ( u'notifications/new_user_email.txt' , context ) html_message = render_to_string ( u'notifications/new_user_email.html' , context ) message = EmailMessage ( subject = subject . strip ( ) , text_body = text_message , html_body = html_message , from_email = settings . SERVER_EMAIL , sender = settings . SERVER_EMAIL , to = [ build_email_address ( full_name = admin [ 0 ] , email = admin [ 1 ] ) for admin in settings . ADMINS ] ) try : message . send ( ) except Exception as e : logging . error ( u"Error sending e-mail notification with subject '%s' on behalf of '%s' to admin: %s" , subject . strip ( ) , from_email , e , exc_info = 1 )
send an e-mail to administrators for newly registered users .