Share via

localhost refused to connect

G Hartman 0 Reputation points
2026-03-25T17:23:48.8033333+00:00

An IMAP account I had successfully connected to Outlook Classic all of a sudden stopped syncing. I removed the account, restarted Outlook, then tried to reattach the IMAP (actually a Google domain account). It is unsuccessful, stating "localhost refused to connect". I didn't change anything?!

Outlook | Windows | Classic Outlook for Windows | For business
0 comments No comments

2 answers

Sort by: Most helpful
  1. Hani-Ng 10,070 Reputation points Microsoft External Staff Moderator
    2026-03-26T04:34:47.1033333+00:00

    Hi G Hartman

    Since the channel tag has changed, could you provide a bit more detail to help narrow down the issue:

    • Which version of Outlook are you currently using (Classic Outlook or the New Outlook)? 
    • Is the affected account a Gmail or Yahoo account?

    There’s a known issue where Gmail and Yahoo accounts stopped syncing in Classic Outlook starting February 26, 2026. Microsoft resolved this with a service-side change on March 20, 2026. If that matches your situation, you may want to try the workaround described in this Microsoft Support article: Users get errors 0x800CCC0E & 0x800CCC0F synchronizing Gmail and Yahoo accounts in classic Outlook … 

    1.Close Outlook. 

    2.Right‑click the Windows Start button, select Run, type regedit, and press OK. 

    3.In the Registry Editor, paste this path into the address bar and press Enter: 

    Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Identity\Identities 

    4.Under Identities, check each subkey until you find the one that matches the email address that is not syncing.

    5.Delete the Identities registry key, example in red below. Look for the corresponding Gmail or Yahoo email address, example in purple. That is the identity key in the left column to delete. After you delete the key, restart Outlook and sign in again.

    Reg edit example

    Please know that while our initial response might not resolve the issue right away, your input is incredibly valuable. With a bit more detail, we’ll work together to find the best solution for you.     


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Q&A Assist
    2026-03-25T17:24:07.61+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The “localhost refused to connect” error with a Gmail/Google Workspace IMAP account in classic Outlook is consistent with the recent Gmail/IMAP sign-in issues described in the documentation.

    Use these steps that match the documented fixes and workarounds:

    1. Confirm Outlook is on a fixed build
      The Gmail sign-in issue is fixed in classic Outlook starting with:
      • Current Channel Version 2404 (Build 17531.10000) for the “browser or app may not be secure” / IMAP setup issue.
      • For the separate consent-scope issue, the Retry flow is available starting with Current Channel Version 2412 (Build 18324.20168).
        In classic Outlook, go to File > Office Account > About Outlook and verify the version/build. If it is older than the builds listed above, update Office and try adding the account again.
    2. Re‑run the Google sign‑in and grant full Gmail access
      When adding the Gmail/Google domain account back to classic Outlook, during the browser sign‑in make sure the consent box is checked for:

      Microsoft apps & services can access: “Read, compose, send, and permanently delete all your email from Gmail.”
      If this was missed previously, on a fixed build you can:

      • Start adding the Gmail account again.
      • When the error appears, use the Retry link in the error window to reopen the browser sign‑in and this time select the full Gmail access scope.
    3. Check IMAP is enabled in Gmail (if applicable)
      The error “We weren’t able to set up your Google account with IMAP. You may need to make changes to your Gmail settings.” can also occur if IMAP is disabled on the Gmail side. For some accounts, Google still exposes an IMAP on/off control. In that case, follow Google’s guidance in Add Gmail to another email client to ensure IMAP is enabled, then retry adding the account in Outlook.
    4. If Outlook never prompts for a password
      If, when adding the IMAP account, Outlook does not ask for a password at all:
      • On the IMAP details page, make sure Require logon using Secure Password Authentication (SPA) is unchecked.
      • If that does not help, use Control Panel to create the account:
        1. Open Control Panel.
        2. Select Mail.
        3. Select Email Accounts….
        4. On the Email tab, select New.
        5. Enter name, email address, and password in both password boxes, then select Next and complete the setup.
    5. If sync still fails with IMAP/POP connection errors
      If after fixing the Gmail sign‑in and IMAP settings Outlook still shows IMAP/POP connection errors, check for the documented TLS 1.3 issue:
      • In the Windows registry under the Protocols key, if TLS 1.3 is present, export that key for backup, then delete the TLS 1.3 key and its subkeys.
      • Restart Outlook, and if needed restart Windows.
        After this change, the registry should no longer show any TLS 1.3 keys, which resolves certain “server unexpectedly terminated the connection” issues for IMAP/POP.

    These steps align with the current Outlook fixes for Gmail/IMAP connectivity problems and should restore syncing for the Google domain IMAP account in classic Outlook.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.