The issue happens with the outgoing mail server settings
All the fields in the outgoing setting are configured properly and then when you try to save the settings an error pops up as below.
The error is the value indicated for the parameter incoming Ews Url is not valid.
Please follow the below steps .
2.* Execute the below queries one by one,
delete from incomingewsserver where authtypeid = 1;
delete from outgoingewsserver where authtypeid = 1;
* Restart the services and configure OAuth again.
The output should be similar to Rows affected =1
Note : If no rows are affected then the query is not working .
In that case please use the below query.
1. delete from incomingewsserver where authtypeid = 1 and helpdeskid = 1;
2. delete from outgoingewsserver where authtypeid = 1 and helpdeskid = 1;