#NEWLINE# def send_confirmation( self , email_address ) : #NEWLINE# #INDENT# salt = hashlib . sha1 ( str ( random ( ) ) ) . hexdigest ( ) [ : 5 ] #NEWLINE# confirmation_key = hashlib . sha1 ( ( salt + email_address . email ) ) . hexdigest ( ) #NEWLINE# current_site = Site . objects . get_current ( ) #NEWLINE# try : #NEWLINE# #INDENT# path = reverse ( 'emailconfirmation.views.confirm_email' , args = [ confirmation_key ] ) #NEWLINE# #UNINDENT# except NoReverseMatch : #NEWLINE# #INDENT# path = reverse ( 'emailconfirmation_confirm_email' , args = [ confirmation_key ] ) #NEWLINE# #UNINDENT# protocol = getattr ( settings , 'DEFAULT_HTTP_PROTOCOL' , 'http' ) #NEWLINE# activate_url = ( '%s://%s%s' % ( protocol , unicode ( current_site . domain ) , path ) ) #NEWLINE# context = { #NEWLINE# #INDENT# 'user' : email_address . user , #NEWLINE# 'activate_url' : activate_url , #NEWLINE# 'current_site' : current_site , #NEWLINE# 'confirmation_key' : confirmation_key , #NEWLINE# #UNINDENT# } #NEWLINE# subject = render_to_string ( 'emailconfirmation/email_confirmation_subject.txt' , context ) #NEWLINE# subject = '' . join ( subject . splitlines ( ) ) #NEWLINE# message = render_to_string ( 'emailconfirmation/email_confirmation_message.txt' , context ) #NEWLINE# send_mail ( confirmation , message , settings . DEFAULT_FROM_EMAIL , [ email_address . email ] ) #NEWLINE# confirmation = self . create ( email_address = email_address , sent = datetime . datetime . now ( ) , confirmation_key = confirmation_key ) #NEWLINE# email_confirmation_sent . send ( sender = self . model , confirmation = confirmation ) #NEWLINE# return confirmation