code: def connect(self):
          
          connection_method = 'SMTP_SSL' if self.ssl else 'SMTP'
          self._logger.debug('Trying to connect via {}'.format(connection_method))
          smtp = getattr(smtplib, connection_method)
          if self.port:
              self._smtp = smtp(self.address, self.port)
          else:
              self._smtp = smtp(self.address)
          self._smtp.ehlo()
          if self.tls:
              self._smtp.starttls()
              self._smtp.ehlo()
          self._logger.info('Got smtp connection')
          if self.username and self.password:
              self._logger.info('Logging in')
              self._smtp.login(self.username, self.password)
          self._connected = True
docs: Initializes a connection to the smtp server
  
          :return: True on success, False otherwise