Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure logging into Outlook #602

Open
DenofTranquility opened this issue Aug 7, 2024 · 3 comments
Open

Failure logging into Outlook #602

DenofTranquility opened this issue Aug 7, 2024 · 3 comments

Comments

@DenofTranquility
Copy link

I've had the same code be working for years but randomly I can't now login to the server.
My credentials are in a separate .env file, I then use python-decouple to import them and login.
I've checked the details multiple times and they are all correct, I use App Passwords from outlook as it doesn't work otherwise.

I used the interactive console to login with the same details and that worked strangely.

I've enabled logging but it hasn't given me any information that I can use.

2024-08-07 17:37:36,759 - DEBUG: < b'PEAA1 NO LOGIN failed.'
2024-08-07 17:37:36,760 - DEBUG: 	matched b'(?P<tag>PEAA\\d+) (?P<type>[A-Z]+) (?P<data>.*)' => (b'PEAA1', b'NO', b'LOGIN failed.')
2024-08-07 17:37:36,760 - DEBUG: NO response: b'LOGIN failed.'
2024-08-07 17:37:36,760 - DEBUG: > b'PEAA2 LOGOUT'
2024-08-07 17:37:36,777 - DEBUG: < b'* BYE Microsoft Exchange Server IMAP4 server signing off.'
2024-08-07 17:37:36,777 - DEBUG: 	matched b'\\* (?P<type>[A-Z-]+)( (?P<data>.*))?' => (b'BYE', b' Microsoft Exchange Server IMAP4 server signing off.', b'Microsoft Exchange Server IMAP4 server signing off.')
2024-08-07 17:37:36,777 - DEBUG: untagged_responses[BYE] 0 += ["b'Microsoft Exchange Server IMAP4 server signing off.'"]
2024-08-07 17:37:36,778 - DEBUG: BYE response: b'Microsoft Exchange Server IMAP4 server signing off.'
2024-08-07 17:37:36,778 - DEBUG: Logged out, connection closed

From the .env file:

IMAP_SERVER_NAME=outlook.office365.com
IMAP_PORT=993
IMAP_ENCRYPTION_METHOD=TLS

From the main.py:

IMAP_server_name = config('IMAP_SERVER_NAME')
IMAP_port = config('IMAP_PORT')
IMAP_encryption_method = config('IMAP_ENCRYPTION_METHOD')

username = config('USERNAME')
password = config('PASSWORD')

    with IMAPClient(IMAP_server_name) as server:
        print(f'[+] Logging in as {username}')
        server.login(username, password)
        print(f'[+] Entering folder {folder}')

Any ideas of what else I could try or have Microsoft nuked the login procedure?

@wiene
Copy link
Contributor

wiene commented Aug 8, 2024

Maybe your observed behavior is related to this Microsoft announcement. To quote the "Basic Authentication interim experience" section of this announcement:

Until September 16th, users signing into Outlook.com through Basic Authentication may experience recurring password prompts in Outlook and other third-party email applications. This is a known issue.

There are similar reports by other people, see e. g. the "July 2024" entry on https://email.faircode.eu/status.

@DenofTranquility
Copy link
Author

Ahh ok, thanks for providing that article it might explain the issue and also the issue I was having in regards to Thunderbird as well.
I'll have a look through the IMAPClient docs and see if there is a way to authenticate using OAuth

@DenofTranquility
Copy link
Author

In case anybody else has this issue, I'm massively struggling to get this to work. Microsoft have made it difficult to actually get into emails. There's heaps of documentation which is good but overwhelming, new granular permissions you can add to an app... After registering it and this was all to get an OAUTH2 token.
I've had to sign up to two different products and even though I can get a token, I still can't access my emails. I may have to purchase a subscription to another Microsoft product although that is unclear, I'm awaiting a sales rep to call me back.

Just a little vent of frustration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants