#NEWLINE# def send_notification_email( self ) : #NEWLINE# #INDENT# if getattr ( settings , 'SEND_EMAIL_NOTIFICATIONS' , False ) : #NEWLINE# #INDENT# from_email = self . get_from_email ( ) #NEWLINE# headers = self . get_email_headers ( ) #NEWLINE# recipients = getattr ( settings , 'TEST_NOTIFICATIONS_RECIPIENTS' , False ) #NEWLINE# if recipients : #NEWLINE# #INDENT# recipients = [ recipient . strip ( ) for recipient in recipients ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# recipients = self . get_recipients_list ( ) #NEWLINE# #UNINDENT# cc_recipients = self . get_cc_recipients_list ( ) #NEWLINE# subject = self . get_email_subject ( ) . strip ( ) #NEWLINE# plaintext_body = self . get_email_plaintext_body ( ) #NEWLINE# html_body = self . get_email_html_body ( ) #NEWLINE# msg = EmailMultiAlternatives ( subject , plaintext_body , from_email , recipients , headers = headers , cc = cc_recipients ) #NEWLINE# if html_body : #NEWLINE# #INDENT# msg . attach_alternative ( html_body , 'text/html' ) #NEWLINE# #UNINDENT# attachment_files = self . get_attachment_files ( ) #NEWLINE# for att in attachment_files : #NEWLINE# #INDENT# msg . attach ( att . name , att . read ( ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# msg . send ( ) #NEWLINE# #UNINDENT# except Exception as exc : #NEWLINE# #INDENT# smtp_code = getattr ( exc , 'smtp_code' , '' ) #NEWLINE# smtp_error = getattr ( exc , 'smtp_error' , '' ) #NEWLINE# error_msg = getattr ( exc , 'message' , '' ) #NEWLINE# self . delivery_response = ( 'Exception: %s\nSMTP code: %s\nSMTP error: %s\nMessage: %s' % ( repr ( exc ) , smtp_code , smtp_error , error_msg ) ) #NEWLINE# self . save ( ) #NEWLINE# if ( not getattr ( settings , 'NOTI_FAIL_SILENTLY' , False ) ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . email_sent = True #NEWLINE# self . save ( )