class_docstr: This hook connects to a mail server by using the smtp protocol.
  
  .. note:: Please call this Hook as context manager via `with`
      to automatically open and close the connection to the mail server.
  
  :param smtp_conn_id: The :ref:`smtp connection id <howto/connection:smtp>`
      that contains the information used to authenticate the client.
docstr: Login to the smtp server.
  
  .. note:: Please call this Hook as context manager via `with`
      to automatically open and close the connection to the smtp server.
  
  :return: an authorized SmtpHook object.
docstr_tok: ["Login","to","the","smtp","server",".","..","note",":",":","Please","call","this","Hook","as","context","manager","via","`","with","`","to","automatically","open","and","close","the","connection","to","the","smtp","server",".",":","return",":","an","authorized","SmtpHook","object","."]
code: def get_conn(self) -> SmtpHook:
      """
      Login to the smtp server.
  
      .. note:: Please call this Hook as context manager via `with`
          to automatically open and close the connection to the smtp server.
  
      :return: an authorized SmtpHook object.
      """
      if not self.smtp_client:
          try:
              self.smtp_connection = self.get_connection(
                  self.smtp_conn_id
              )
          except AirflowNotFoundException:
              raise AirflowException("SMTP connection is not found.")
  
          for attempt in range(1, self.smtp_retry_limit + 1):
              try:
                  self.smtp_client = self._build_client()
              except smtplib.SMTPServerDisconnected:
                  if attempt == self.smtp_retry_limit:
                      raise AirflowException(
                          "Unable to connect to smtp server"
                      )
              else:
                  if self.smtp_starttls:
                      self.smtp_client.starttls()
                  if self.smtp_user and self.smtp_password:
                      self.smtp_client.login(
                          self.smtp_user, self.smtp_password
                      )
                  break
  
      return self
  
imports: from __future__ import annotations
  import collections.abc
  import os
  import re
  import smtplib
  import ssl
  from email.mime.application import MIMEApplication
  from email.mime.multipart import MIMEMultipart
  from email.mime.text import MIMEText
  from email.utils import formatdate
  from typing import TYPE_CHECKING, Any, Iterable
  from airflow.exceptions import AirflowException, AirflowNotFoundException
  from airflow.hooks.base import BaseHook
label_desc: Use image node_id 4 for calling the SmtpHook obj's underlying member method code with example usage: obj.get_conn() and returns: self