Arduino Nano 33 IoT connection to MQTT broker and subscribing to topics

Any idea why?
After the lines

 if (sendEmailFlag) {
    sendEmail();
    sendEmailFlag = false; // Reset the flag after sending the email
  }

it's also disconnected from MQTT brocker and stuck in that loop:

void reconnect() {
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    if (client.connect("ArduinoNano33IoTClient", mqtt_user, mqtt_password)) {
      Serial.println("connected");
      client.subscribe(subscribe_topic);
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      delay(5000);
    }
  }
}

This is the text I get in the serial monitor:

Hi, I just wanted to post here that this works now. Thanks for your comments.

I ordered a D1 Mini ESP8266MOD board and I will change the code so it runs on this cheaper board as well. I hope it will work...

Best regards,
Daniel