#NEWLINE# def send_email( self , spt_name , **context ) : #NEWLINE# #INDENT# context [ 'participant' ] = self #NEWLINE# context [ 'username' ] = self . username #NEWLINE# context [ 'button_style' ] = 'color: #fff; text-decoration:none; display:inline-block; padding: 0 15px; background: #396; white-space: nowrap; font: normal 14px/40px Arial, sans-serif; border-radius: 3px' #NEWLINE# context . setdefault ( 'include_unsubscribe' , True ) #NEWLINE# email = context . setdefault ( 'email' , self . email_address ) #NEWLINE# if ( not email ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# langs = i18n . parse_accept_lang ( ( self . email_lang or 'en' ) ) #NEWLINE# locale = i18n . match_lang ( langs ) #NEWLINE# i18n . add_helpers_to_context ( self . _tell_sentry , context , locale ) #NEWLINE# context [ 'escape' ] = ( lambda s : s ) #NEWLINE# context_html = dict ( context ) #NEWLINE# i18n . add_helpers_to_context ( self . _tell_sentry , context_html , locale ) #NEWLINE# context_html [ 'escape' ] = htmlescape #NEWLINE# spt = self . _emails [ spt_name ] #NEWLINE# base_spt = self . _emails [ 'base' ] #NEWLINE# def render( t , context ) : #NEWLINE# #INDENT# b = base_spt [ t ] . render ( context ) . strip ( ) #NEWLINE# return b . replace ( '$body' , spt [ t ] . render ( context ) . strip ( ) ) #NEWLINE# #UNINDENT# message = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# message [ 'Source' ] = 'Gratipay Support <support@gratipay.com>' #NEWLINE# message [ 'Destination' ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# message [ 'Destination' ] [ 'ToAddresses' ] = [ ( '%s <%s>' % ( self . username , email ) ) ] #NEWLINE# message [ 'Message' ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# message [ 'Message' ] [ 'Subject' ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# message [ 'Message' ] [ 'Subject' ] [ 'Data' ] = spt [ 'subject' ] . render ( context ) . strip ( ) #NEWLINE# message [ 'Message' ] [ 'Body' ] = { #NEWLINE# #INDENT# 'Text' : { #NEWLINE# #INDENT# 'Data' : render ( 'text/plain' , context ) , #NEWLINE# #UNINDENT# } , #NEWLINE# 'Html' : { #NEWLINE# #INDENT# 'Data' : render ( 'text/html' , context_html ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . _mailer . send_email ( ** message ) #NEWLINE# return 1