Share via

Email-Oauth2-Proxy fix error

Minh Hiếu Trần 220 Reputation points
2025-07-17T05:01:53.62+00:00

I have a email-oauth2-proxy downloaded by the github with link: https://github.com/simonrob/email-oauth2-proxy but i creted account on windows mail and calender with error:

2025-07-17 11:50:17: Initialising Email OAuth 2.0 Proxy (version 2025-06-25) from config file C:\Users\minhh\Desktop\email-oauth2-proxy-main\emailproxy.config

2025-07-17 11:50:17: Starting IMAP server at 127.0.0.1:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS)

2025-07-17 11:50:17: Starting POP server at 127.0.0.1:1995 (unsecured) proxying outlook.office365.com:995 (SSL/TLS)

2025-07-17 11:50:17: Starting SMTP server at 127.0.0.1:1587 (unsecured) proxying smtp-mail.outlook.com:587 (STARTTLS)

2025-07-17 11:50:17: Starting IMAP server at 127.0.0.1:2993 (unsecured) proxying imap.gmail.com:993 (SSL/TLS)

2025-07-17 11:50:17: Starting POP server at 127.0.0.1:2995 (unsecured) proxying pop.gmail.com:995 (SSL/TLS)

2025-07-17 11:50:17: Starting SMTP server at 127.0.0.1:2465 (unsecured) proxying smtp.gmail.com:465 (SSL/TLS)

2025-07-17 11:50:17: Initialised Email OAuth 2.0 Proxy - listening for authentication requests. Connect your email client to begin

2025-07-17 11:52:03: Accepting new connection from 127.0.0.1:63097 to IMAP server at 127.0.0.1:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS)

2025-07-17 11:52:04: Accepting new connection from 127.0.0.1:63099 to IMAP server at 127.0.0.1:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS)

2025-07-17 11:52:04: Accepting new connection from 127.0.0.1:63100 to IMAP server at 127.0.0.1:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS)

2025-07-17 11:52:04: IMAP (127.0.0.1:1993) Caught connection error (server) [ Client attempted to send command without waiting for server greeting ] - OSError : [WinError 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied

2025-07-17 11:52:04: Accepting new connection from 127.0.0.1:63103 to IMAP server at 127.0.0.1:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS)

2025-07-17 11:52:04: IMAP (127.0.0.1:1993) Caught connection error (server) [ Client attempted to send command without waiting for server greeting ] - OSError : [WinError 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied

2025-07-17 11:52:04: Accepting new connection from 127.0.0.1:63105 to IMAP server at 127.0.0.1:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS)

2025-07-17 11:52:04: IMAP (127.0.0.1:1993) Caught connection error (server) [ Client attempted to send command without waiting for server greeting ] - OSError : [WinError 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied

someone help me, please??

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

Answer accepted by question author

Winnie-B 7,770 Reputation points Microsoft External Staff Moderator
2025-07-17T09:18:00.7066667+00:00

Hi Minh Hiếu,

Thanks for reaching out in the Microsoft Q&A. I understand that you're setting up the email-oauth2-proxy tool to connect your Outlook account with the Windows Mail and Calendar app, but encountering repeated errors like: Client attempted to send command without waiting for server greeting OSError : [WinError 10057] 

Let's break down the issue based on the log file you provided. 

  1. Client Protocol Issue 

◦ The Windows Mail client might not follow the IMAP protocol specifications when connecting to the proxy (sending commands before waiting for the server greeting).

◦ The log shows multiple connection attempts (e.g., 127.0.0.1:63097), all failing due to protocol errors.

  1. Proxy Configuration Issue

◦ email-oauth2-proxy listens on unsecured ports by default (e.g., 1993), but the client might mistakenly expect SSL/TLS.

  1. OAuth2 Authentication Incomplete

◦ If OAuth2 authentication is not properly completed (e.g., no login or invalid token), the proxy may fail to forward requests to Office 365.

Here are some suggestions that might help troubleshooting: 

1. Check Client Configuration 

• In the Windows Mail app, ensure:

Server address: 127.0.0.1 (proxy address)

Port: 1993 (IMAP) or 1587 (SMTP)

Disable SSL/TLS: The proxy itself is unsecured (log shows unsecured), but it forwards to Office 365’s encrypted ports (e.g., 993).

Username: Full email address (e.g., user@example.com).

Password: May need to be left blank (relies on OAuth2 token) or filled with a dummy value (check proxy requirements).

2. Complete OAuth2 Authentication 

  • On the first run, the proxy should prompt you to log in via a browser to authorize the Microsoft account. 
  • Check if refreshtoken.txt or accesstoken.txt has been generated (in the proxy directory). 
  • If authentication fails, delete these token files and restart the proxy. 

3. Modify Proxy Configuration 

  • Open emailproxy.config and verify: 
  • Make sure the Azure AD app is registered with correct client_id and client_secret (requires SMTP.Send, IMAP.AccessAsUser.All permissions). 

[OAUTH2] 

client_id = YOUR_AZURE_APP_CLIENT_ID  

client_secret = YOUR_AZURE_APP_CLIENT_SECRET 

tenant_id = common  

redirect_uri = [http://localhost:8080] 

If the issue still persists: Contact the Developer

Please note that email-oauth2-proxy is a community project developed and maintained by a user on GitHub, not an official Microsoft product. If you have followed all the steps above and are still facing issues, the problem may require a code-level fix or specific knowledge from the author. 

Really hope this gets you back on track! Please feel free to reach out again if you need further assistance. 

Best regards, 
Winnie – MSFT | Microsoft Q&A Support Specialist 

Was this answer helpful?


0 additional answers

Sort by: Most helpful

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.