To use EWS for incoming ( or ) outgoing mail server settings, one needs to know the exact connect URL. Generally, the connect URL syntax will be like https://<your_server_name>/EWS/Exchange.asmx
In case of On-Premises, one can get to know their Exchange's Connect URL ( EWS URL ) by the following steps
i) Using Exchange Management Shell
> Go to your Exchange Server.
> Open Exchange Management Shell
> Type the below command and execute
Get-WebServicesVirtualDirectory | fl
> You can get the EWS URL from the InternalURL and ExternalURL. Use ExternalURL if available.
ii) Using Exchange Admin Centre ( /ecp )
> Login as administrator to the /ecp portal of your Exchange Server.
> Go to Servers >> Virtual Directories.
> Select your Exchange Server and select the Server Type as Exchange Web Services ( EWS ).
> Double click the EWS server. You can see the window as shown in the image below
> You can get the EWS URL from the InternalURL and ExternalURL. Use ExternalURL if available.