Microsoft has come up with a little change. If you are using Outlook 365 as your mail provider, you may need to create a specific password to only be used by the archiving script. Following are the instructions on how to do that (taken from duck.ai, so may be wrong)
To generate an app password for your Microsoft Outlook account, especially if you have two-factor authentication (2FA) enabled, follow these steps:
Sign in to Your Microsoft Account:
Navigate to Security Settings:
Access Additional Security Options:
Create an App Password:
Copy the App Password:
Use the App Password: