Failed to connect for server named: SERVERNAME with user name Username@domain.com
Unable to connect to an office 365 shared mailbox
Share Mailboxes work in a different way in Office365 so the details you might use onprem do not work once migrated to office365
Solution / Workaround:
I found the following method to work based on some Microsoft forums.
Settings for IMAP Configuration:
IMAP SERVER: outlook.office365.com
USERNAME: email@example.com\shared-mailbox (user\shared mailbox alias)
PASSWORD: password (user's password)
The connection should now work.