simonrob/email-oauth2-proxy

Hotmail Email Proxy - Cannot Establish Connection

Closed this issue · 4 comments

HI Simon,
I'm really interested in using your email proxy to authenticate with my email accounts. Specifically, Hotmail.
I've set it up quite basic:

[IMAP-1993]
documentation = *** note: this server will work for both Office 365 and personal Outlook/Hotmail accounts ***
server_address = outlook.office365.com
server_port = 993
local_address = 127.0.0.1

[POP-1995]
documentation = *** note: this server will work for both Office 365 and personal Outlook/Hotmail accounts ***
server_address = outlook.office365.com
server_port = 995
local_address = 127.0.0.1

[SMTP-1587]
documentation = *** note: this server will work for both Office 365 and personal Outlook/Hotmail accounts ***
server_address = smtp-mail.outlook.com
server_port = 587
server_starttls = True
local_address = 127.0.0.1

[<Hotmail Address>]
permission_url = https://login.microsoftonline.com/common/oauth2/v2.0/authorize
token_url = https://login.microsoftonline.com/common/oauth2/v2.0/token
oauth2_scope = https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/POP.AccessAsUser.All https://outlook.office.com/SMTP.Send offline_access
redirect_uri = http://localhost
client_id = <generated using Azure account>

I'm using it via Docker (https://github.com/blacktirion/email-oauth2-proxy-docker) and I can see the log file which indicates all good:

2025-03-01 08:29:06,017: Initialising Email OAuth 2.0 Proxy (version 2024-11-13) in debug mode from config file /config/emailproxy.config
2025-03-01 08:29:06,085: Starting IMAP server at 127.0.0.1:1993 (unsecured) proxying outlook.office365.com:993 (SSL/TLS)
2025-03-01 08:29:06,136: Starting POP server at 127.0.0.1:1995 (unsecured) proxying outlook.office365.com:995 (SSL/TLS)
2025-03-01 08:29:06,137: Starting SMTP server at 127.0.0.1:1587 (unsecured) proxying smtp-mail.outlook.com:587 (STARTTLS)
2025-03-01 08:29:06,142: Initialised Email OAuth 2.0 Proxy - listening for authentication requests. Connect your email client to begin

It accepts the connection, but then immediately closes it, not sure what I'm doing wrong?

> telnet 127.0.0.1 1993
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.

Please post the log from the proxy in --debug mode so we can see whether it is actually receiving a connection attempt.

That's all I see in the log, it is currently running in debug mode:

Image

Do you have anything else listening on localhost?

It may also be worth trying listening on a different address given the Docker layer that you're connecting through.

I'm going to assume this has been resolved, so am closing this issue.