#NEWLINE# def _send_email( self , result , previous_state ) : #NEWLINE# #INDENT# subject = Template ( self . config [ 'subject_template' ] ) #NEWLINE# subject . environment . undefined = SimpleUndefined #NEWLINE# body = Template ( self . config [ 'body_template' ] ) #NEWLINE# body . environment . undefined = SimpleUndefined #NEWLINE# sender = self . config [ 'sender' ] #NEWLINE# recipients = self . config . get ( 'recipients' , [ ] ) #NEWLINE# result_data = result . serialize ( ) #NEWLINE# if recipients : #NEWLINE# #INDENT# logger . debug ( 'Sending SES alert to %s as %s for %s.' , recipients , sender , result . id ) #NEWLINE# self . aws_conn . ses . send_email ( source = sender , subject = subject . render ( result_data ) , body = body . render ( result_data ) , to_addresses = recipients ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . debug ( 'No valid recipients found, not sending email for %s.' , result . id )