This example combines the standard "Knollery" Pubsubclient with WiFiManager so that you can easily configure broadband and MQTT settings on your ESP8266 via a HTML webpage.
Once the settings are stored, the ESP8266 can send a MQTT message through your broadband to any password protected MQTT broker of your choice - either locally in your network or external (e.g. CLOUDMQTT )