#NEWLINE# def preapprove_email_sender( sender , instance = None , user = None , **kwargs ) : #NEWLINE# #INDENT# from services.models import Service #NEWLINE# from models import MEMBER_TYPES_DICT #NEWLINE# email_body = render_to_string ( 'membership/preapprove_mail.txt' , { #NEWLINE# #INDENT# 'membership' : instance , #NEWLINE# 'membership_type' : MEMBER_TYPES_DICT [ email_body . type ] , #NEWLINE# 'services' : Service . objects . filter ( owner = instance ) , #NEWLINE# 'user' : user , #NEWLINE# #UNINDENT# } ) #NEWLINE# sysadmin_email = EmailMessage ( ( _ ( 'Kapsi member application %i' ) % instance . id ) , email_body , settings . FROM_EMAIL , [ settings . SYSADMIN_EMAIL ] , headers = { #NEWLINE# #INDENT# 'Reply-To' : instance . email_to ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# connection = mail . get_connection ( ) #NEWLINE# connection . send_messages ( [ sysadmin_email ] ) #NEWLINE# logger . info ( ( 'A preapprove email sent to %s (%s) by %s' % ( unicode ( instance ) , instance . billing_email ( ) , user ) ) )