class_docstr: This hook connects to a mail server by using the imap protocol.
  
  .. note:: Please call this Hook as context manager via `with`
      to automatically open and close the connection to the mail server.
  
  :param imap_conn_id: The :ref:`imap connection id <howto/connection:imap>`
      that contains the information used to authenticate the client.
code: def _retrieve_mails_attachments_by_name(
      self,
      name: str,
      check_regex: bool,
      latest_only: bool,
      mail_folder: str,
      mail_filter: str,
  ) -> list:
      if not self.mail_client:
          raise Exception(
              "The 'mail_client' should be initialized before!"
          )
  
      all_matching_attachments = []
  
      self.mail_client.select(mail_folder)
  
      for mail_id in self._list_mail_ids_desc(mail_filter):
          response_mail_body = self._fetch_mail_body(mail_id)
          matching_attachments = self._check_mail_body(
              response_mail_body, name, check_regex, latest_only
          )
  
          if matching_attachments:
              all_matching_attachments.extend(matching_attachments)
              if latest_only:
                  break
  
      self.mail_client.close()
  
      return all_matching_attachments
  
imports: from __future__ import annotations
  import email
  import imaplib
  import os
  import re
  import ssl
  from typing import TYPE_CHECKING, Any, Iterable
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.utils.log.logging_mixin import LoggingMixin
label_desc: Use image node_id 10 for calling the ImapHook obj's underlying member method code with example usage: obj._retrieve_mails_attachments_by_name(name, check_regex, latest_only, mail_folder, mail_filter) and returns: all_matching_attachments