code: def connect(self):
          
          app = getattr(self, "app", None) or current_app
          try:
              return Connection(app.extensions['mail'])
          except KeyError:
              raise RuntimeError("The curent application was"
                                 " not configured with Flask-Mail")
docs: Opens a connection to the mail host.