# Evolution and EWS OAuth2



## CanOfBees (Aug 12, 2021)

Hi all -

I'm slowly rebuilding a FreeBSD workstation and I'm running into a strange issue with mail/evolution and mail/evolution-ews. When I work through the create a new account process, I should get an OAuth2 dialog popup after the final step, but things seem to time out. I'm wondering if anyone here has had any success connecting with Office 365/Outlook with mail/evolution-ews. mail/evolution is the blessed OSS client for my institution's Microsoft Office 365 Exchange server, but they don't provide support beyond some basic, "here's your connection info" documentation.

If I run mail/evolution from the command line with the following settings:

```
export OAUTH2_DEBUG=1
export EWS_DEBUG=2
evolution
```
After working through the New Account dialog, I get:

```
(evolution:6014): e-mail-engine-WARNING **: 19:19:54.184: mail_folder_cache_note_store_thread: Failed to run initial setup for 'myemailacct@myinst.edu': No response: Timeout was reached
```

To be frank, I'm not even sure where mail/evolution might be outputting logs, so any help/thoughts/observations would be most appreciated. I had this working on a FreeBSD 12.0 box, but this is a fresh install of FreeBSD 13.0-RELEASE-p3.


```
) pkg info | grep evolution
evolution-3.40.2               Integrated mail, calendar and address book distributed suite
evolution-data-server-3.40.2   Data backends for the Evolution integrated mail/PIM suite
evolution-ews-3.40.2           Evolution Microsoft Exchange plugin through Exchange Web Services
```


----------



## Phishfry (Aug 12, 2021)

I can't help but the default location for logs is in /var
Dig around there would be my starting place. Checking subdirectories too.

All your Freshports links are broken. You must use port category/portname.
mail/evolution


----------



## CanOfBees (Aug 13, 2021)

Phishfry - 

Thank you for the response (and the reminder about proper formatting!). I've checked through /var/ but don't have anything other than high level messages. There *are* core dumps, but I don't have any real experience understanding core files.

I appreciate the help.


----------



## SirDice (Aug 13, 2021)

CanOfBees said:


> ```
> Failed to run initial setup for 'myemailacct@myinst.edu': No response: Timeout was reached
> ```


The configured mailserver for that account couldn't be reached. Timeouts often indicate firewall issues.


----------



## CanOfBees (Aug 13, 2021)

SirDice said:


> The configured mailserver for that account couldn't be reached. Timeouts often indicate firewall issues.


SirDice - thanks for that observation. I'm away from this system today, but I'll take a look at my firewall settings when I'm back at that particular desk.


----------



## kpedersen (Aug 13, 2021)

A while back I was in the same boat. One option to try is davmail. It bridges the Microsoft nonsense and exposes it as proper standard protocols (imap(s)/smtp(s)). Then you can use evolution in normal mode connecting to localhost (your davmail bridge). At the very least davmail might provide some help debugging your issue.

What the IT services recommended for me originally was this POS: https://www.bluemail.me/
Proprietary and Linux only and it really does little more than embedding a web browser into an "app frame". Worst case scenario, you might be able to run it in the Linux emulation layer. Though perhaps Outlook in Wine would be a similar choice.


----------



## Phishfry (Aug 13, 2021)

I know this is old but gives you an example to force logging.








						ubuntu 12.04.2 - evolution 3.2.3: Is there a Logfile?
					

my evo does not send mail. Servers are correct. Is there a log file to see what evolution is doing ? A few days ago, everything still was fine.  Is there any other logfile, I could check ?  Thanks in




					askubuntu.com
				



Note the lower posting for ews command line options..


----------



## CanOfBees (Aug 16, 2021)

Phishfry - 

thanks for the link. Adding the `CAMEL_DEBUG=all` definitely provides more information; I just don't know what would be helpful at this point.


----------



## CanOfBees (Aug 16, 2021)

kpedersen - thank you for suggestion. It's beginning to look like I may have a separate issue that's causing this, but all the same: email/davmail may prove useful!

Thanks, I appreciate it!


----------



## CanOfBees (Aug 16, 2021)

SirDice said:


> The configured mailserver for that account couldn't be reached. Timeouts often indicate firewall issues.


SirDice - 
thanks again for the suggestion. I'm using IPFW and I've tried temporarily disabling the firewall entirely. I was able to get a bit farther through the authentication process, but the process still fails. We use Duo Security for 2FA, and the process fails with 500 Internal Service Error. The same thing happens when I try to access Office365 through FireFox, so now I'm wondering if I'm missing a library somewhere. 

Over the weekend I was able to move through the same authentication process on a 12.1-RELEASE system at home, so I'm not sure what's going on . While I'm pretty sure the packages are similar, I don't have a list of possible differences. 

I really appreciate everyone's helpful comments. Thank you for your time!


----------



## SirDice (Aug 17, 2021)

CanOfBees said:


> We use Duo Security for 2FA, and the process fails with 500 Internal Service Error.


500 Internal server error is an issue on the website itself. It's not a client issue.


----------



## CanOfBees (Aug 17, 2021)

SirDice said:


> 500 Internal server error is an issue on the website itself. It's not a client issue.


Debugging this is beyond my meager skills, and I won't argue with your assessment beyond the following: the 2FA authentication process also fails in plain Firefox, but succeeds in Chromium. So, there's definitely a problem on here at the end user's side but I couldn't begin to say what it was. 

In any case, thank  you all for your help and time!


----------



## SirDice (Aug 17, 2021)

A 500 server error is generated on the web server itself. This can happen if the code that runs on the website runs into an unknown situation and the software crashes (or stops with an error message). This could happen if the client sends the wrong parameters for example. But the server code should never crash on that, it should have a proper error handling and just give you a message you gave it the wrong parameters. So even if your client provides the wrong parameters the server should never respond with a 500 server error. That's just bad programming on the server side.


----------

