I didn’t know if the photo was your phone or from the thread that you posted.
For the imap.gmail.com go to Settings/Passwords & Accounts, tap on the gmail account and delete it.
Then restart your phone—>Restart your iPhone - Apple Support. (The restart is important, because without it when you add it back it will use the old data from the account.) Then add your gmail account back by going back to Settings/Passwords & Accounts, tapping Add Account then gmail and filling out the form. As it’s an IMAP account it will resync your messages with the server.
For the CaptivePortal error, I assume you are using a Nokia public website or a public website hosted by Nokia. Open Settings/Wi-Fi, find the network that you were trying to access when you got that message, tap on the i next to it and then “forget this network”. The next time you try to connect it should work. But public networks change their certificates frequently, so you can’t stay connected continuously for more than a few days without disconnecting and reconnecting.
While checking, go to Settings/Passwords & Accounts, scroll down to Subscribed Calendars, and review the calendars there. If any look unusual tap on each and delete it. There are no default subscribed calendars, so any that appear you added. If you didn’t add any the space should be empty under Subscribed Calendars.
Finally, to leave no stone unturned, go to Settings/General. Scroll to the bottom and look just below VPN. If there is an entry for Profiles or Device Management (there may not be) tap on it and review the profile certificates, and delete any you don’t recall installing.
If you continue to have problems after these steps post back; we haven’t used all of the arrows in the quiver.