Squirrelmail is a web frontend for an IMAP server, and it's telling you it can't connect to that IMAP server.
In your case, the IMAP server is Dovecot. Either Dovecot isn't running, or the IMAP daemon is running on the wrong port or isn't bound to the "localhost" (127.0.0.1) IP (which will happen if you specify an IP address in the config file).
You should check your Dovecot configuration. Here's
the relevant Wiki page from dovecot.org.