original_docstring: Send the data file by email
docstring: Send the data file by email
docstring_tokens: Send the data file by email
code: def send_mail(self, user, request, context):
          """Send the data file by email"""
          host = request.get_host()
          email_config = {
              'subject': _('Exported file delivery'),
              'message': _('Sent from address {0!s}. The file is attached.').format(host),
              'from_email': settings.DEFAULT_FROM_EMAIL,
              'recipient_list': [user.email],
              'fail_silently': True,
              'html_message': False
          }
          email_config.update(self.export_email_config)
  
          def send_mail_async(config, data, context):
              filename, content, file_mimetype = self._get_file_spec(data, context)
  
              html_message = config.pop('html_message', False)
              fail_silently = config.pop('fail_silently', True)
  
              # compat
              config['body'] = config.pop('message', '')
              config['to'] = config.pop('recipient_list', None)
  
              mail = EmailMultiAlternatives(**config)
              if html_message:
                  mail.attach_alternative(html_message, 'text/html')
  
              mail.attach(filename, content, file_mimetype)
              mail.send(fail_silently=fail_silently)
  
          thargs = (email_config.copy(),
                    copy.deepcopy(request.GET),
                    context.copy())
          th = threading.Thread(target=send_mail_async, args=thargs)
          th.start()
code_tokens: def send_mail ( self , user , request , context ) : host = request . get_host ( ) email_config = { 'subject' : _ ( 'Exported file delivery' ) , 'message' : _ ( 'Sent from address {0!s}. The file is attached.' ) . format ( host ) , 'from_email' : settings . DEFAULT_FROM_EMAIL , 'recipient_list' : [ user . email ] , 'fail_silently' : True , 'html_message' : False } email_config . update ( self . export_email_config ) def send_mail_async ( config , data , context ) : filename , content , file_mimetype = self . _get_file_spec ( data , context ) html_message = config . pop ( 'html_message' , False ) fail_silently = config . pop ( 'fail_silently' , True ) config [ 'body' ] = config . pop ( 'message' , '' ) config [ 'to' ] = config . pop ( 'recipient_list' , None ) mail = EmailMultiAlternatives ( ** config ) if html_message : mail . attach_alternative ( html_message , 'text/html' ) mail . attach ( filename , content , file_mimetype ) mail . send ( fail_silently = fail_silently ) thargs = ( email_config . copy ( ) , copy . deepcopy ( request . GET ) , context . copy ( ) ) th = threading . Thread ( target = send_mail_async , args = thargs ) th . start ( )
short_docstring: Send the data file by email
short_docstring_tokens: Send the data file by email
comment: """Send the data file by email"""$SEP$# compat