This patch adds two options, davmail.cookieFilePath and
davmail.cookiesNeverExpire, to let davmail import existing cookie files for
complicated setups. This allows you to login to your company's owa URL no matter how braindead their setup is, export your cookies to a cookies.txt file (ie with https://addons.mozilla.org/en-US/firefox/addon/export-cookies/), and have davmail use that.
I've attached the patch, and it's also at my github repository:
https://github.com/moparisthebest/davmail/commit/e317746a7467d5e543198f50a84a57fb4a83e37e
I had to do this for my company, because I have to type in webmail.company.com, which forwards me to a microsoft login, where I type in my email address and before I type in my password it forwards me to someothersite.company.com where I must login with my active directory credentials, then it forwards me back to webmail.company.com where I can finally type in my email and password and click a link to outlook.office365.com, which loads up my inbox. THEN I export these cookies and davmail works...
... and I thought cloud access would make Exchange access simple ;-)
Anyway, other Office365 users use the following URL:
https://outlook.office365.com/EWS/Exchange.asmx
Can you please confirm this does not work in your case ?
Yes me too :) Also I can only access webmail from the corporate network, which I think mostly defeats the purpose of webmail does it not?...
That is the URL I use as well, but it follows all of those redirects and can't handle the varied input to them so this cookie solution is the only sane one I could come up with.
I added the /EWS/Exchange.asmx to DavMail's OWA URL setting and now my POP3 client can get my email again; thank you!
That url does not seem to do anything (for IMAP using Thunderbird client on linux). Still having the issue where my OWA access stopped working.
Should not be necessary with Office 365, DavMail nows works event with MFA enabled, just use the app password instead of the normal password.
assumes your organization allows app password; mine does not.
Reopen
i applied this patch and added some logging but could not authenticate to https://outlook.office365.com/EWS/Exchange.asmx using cookies exported from chromium or firefox. i cleared all cookies before login to OWA.
That's what I feared, there is no relation between OWA and EWS authentication.
Another question: are you able to use desktop apps ?
According to this:
https://social.technet.microsoft.com/wiki/contents/articles/36101.office-365-enable-modern-authentication.aspx
new desktop applications no longer need app password, not sure if they use the REST API or EWS with an oauth token
evolution-ews requires some custom configuration in Azure Active Directory but is usable on desktop.
Indeed importing a cookie is not enough we need to implement Oauth2 support
Update: we now have a working implementation of Oauth2 MFA authentication with Office 365, see: https://sourceforge.net/p/davmail/feature-requests/111/
=> I confirm that importing cookies is not enough, you need the Oauth Bearer header (token)
=>will not merge this patch