caronc / apprise

Apprise - Push Notifications that work with just about every platform!
https://hub.docker.com/r/caronc/apprise
BSD 2-Clause "Simplified" License
11.97k stars 418 forks source link

Outlook basic authentication with app password is deprecated #1217

Open bwirt opened 1 month ago

bwirt commented 1 month ago

:mega: Notification Service(s) Impacted Outlook.com email

:lady_beetle: Describe the bug Calls to /notify fail for email notifications using Outlook.com accounts. It appears Microsoft has disabled basic authentication and now requires oauth2.

:bulb: Screenshots and Logs Response from POST notify/myconfig results in 424:

{
  "error": "One or more notification could not be sent",
  "details": [
    [
      "INFO",
      "2024-10-04 10:33:01,243",
      "Loaded 2 entries from memory://"
    ],
    [
      "INFO",
      "2024-10-04 10:33:01,243",
      "Notifying 2 service(s) with threads."
    ],
    [
      "WARNING",
      "2024-10-04 10:33:06,994",
      "Connection error while submitting email to smtp.outlook.com. Reason: (535, b'5.7.139 Authentication unsuccessful, basic authentication is disabled. [MW4PR04CA0237.namprd04.prod.outlook.com 2024-10-04T15:33:06.965Z 08DCE442F5AF553A]')"
    ],
    [
      "INFO",
      "2024-10-04 10:33:07,625",
      "Sent 1 Signal API notification to +12065551212."
    ]
  ]
}

My configuration:

signal=signal://signal-api.my.org/+12065551212/?batch=no&status=no&format=text&overflow=upstream&rto=30&cto=4.0&verify=yes
outlook=mailtos://outlook.com?smtp=smtp.outlook.com&user=myaccount@outlook.com&pass=myAppPassword&from=Me<myaccount@outlook.com>

# groups
email=outlook
messenger=signal

:computer: Your System Details: Docker container on Ubuntu

:crystal_ball: Additional context This was working until a day or two ago. Updated my app password and still doesn't work. Others online appear to be having this issue as well.

https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online#pop-imap-and-smtp-auth

caronc commented 1 month ago

Thank you for reporting this! πŸ™

caronc commented 1 month ago

Having sat down and looked at it, it occured to me that the solution is already in place, have you looked at this which leverages the Oauth2 recommended alternative.

Although open issues #836 and #858 may identify that this solution may be lacking documentation and still require further investigation.

Austenite2 commented 1 month ago

Having sat down and looked at it, it occured to me that the solution is already in place, have you looked at this which leverages the Oauth2 recommended alternative.

Doesn't that require Azure tenants? I am just trying to use Moonraker to send an email to my outlook.com account, I can't see how that Oauth solution helps in my case. (Thanks for your great work!)

For completenes, in moonraker.conf: [notifier email] url: mailtos://outlook.com?smtp=smtp-mail.outlook.com&from=Voron<myaccount@outlook.com>&user=myaccount@outlook.com&pass=mypass events: complete, error, paused body: "Your printer status has changed to {event_name}" title: "Your printer status has changed to {event_name}"

Moonraker log: 2024-10-04 10:29:38,465 [klippy_apis.py:pause_print()] - Requesting job pause... 2024-10-04 10:29:39,059 [apprise.py:_notify_parallel_asyncio()] - Notifying 1 service(s) asynchronously. 2024-10-04 10:29:47,633 [email.py:submit()] - Connection error while submitting email to smtp-mail.outlook.com. Reason: (535, b'5.7.139 Authentication unsuccessful, basic authentication is disabled. [SY5P282CA0093.AUSP282.PROD.OUTLOOK.COM 2024-10-04T09:29:47.619Z 08DCE39B196D8EF9]')

This also used to work until recently.

caronc commented 1 month ago

Microsoft doesn't always make things easy. πŸ˜‰ All of their platforms are very tightly woven together. You need to use Azure because it opens the door to use the API (which in turn can talk back to you Outlook instance.

It doesn't cost you anything; in this case, you're only using it as a portal to generate your OAuth2 setup (not virtual machines or other costly tools)

Austenite2 commented 1 month ago

Thanks for that - I worked through it (configuration worked ok once working out need to go to Entra ID after signing for up for Azure.)

However, when trying to use, get response 400 with details "{email} is configured for use by Microsoft Account users only. Please use the /consumers endpoint to serve this request." This might be new?

Perhaps best would be to advise outlook.com users to just sign up for a hotmail account! Already signed up with Microsoft anyway, much easier, don't need to provide a credit card, and no 2 year limitation on secret. I'm assuming it's not also an issue with hotmail accounts?

caronc commented 1 month ago

I'll definitely investigate and see if i can refactor the code so it works better