docs: def send_mail(send_from, send_to, subject, text, server, mime='plain', files=None):
      """
      Send an email with attachments.
      :param send_from: from email adress
      :param send_to: to email adress
      :param subject: email subject
      :param text: text of the email in html
      :param server: SMTP server
      :param files: files to attach
      :return: None
      """
      if not files:
          files = []
  
      assert type(send_to) == list
      assert type(files) == list
  
      msg = MIMEMultipart()
      msg['From'] = send_from
      msg['To'] = COMMASPACE.join(send_to)
      msg['Date'] = formatdate(localtime=True)
      msg['Subject'] = subject
  
      msg.attach(MIMEText(text, mime))
  
      for f in files:
          part = MIMEBase('application', "octet-stream")
          fp = open(f, "rb")
          file_content = fp.read()
          part.set_payload(file_content)
          encoders.encode_base64(part)
          part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(f))
          msg.attach(part)
  
      smtp = smtplib.SMTP(server)
      smtp.sendmail(send_from, send_to, msg.as_string())
      smtp.close()
      return