Get Exchange Mail Messages: Could not establish trust relationship for the SSL/TLS secure channel

Hi all,

I would like to Get Exchange Mail Messages but error: Could not establish trust relationship for the SSL/TLS secure channel. I have tried to download the certificate using browser and install the certificate but still got the same error. Any idea how to establish trust relationship in UiPath Robot/Studio? Thanks in advance.

Here are following error:

19.4.4+Branch.support/v2019.4.Sha.6d308c7f5a32b559373887ae421ce7eaec8f8d24

Source: Get Exchange Mail Messages

Message: The request failed. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

Exception Type: UiPath.Mail.ExchangeException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
UiPath.Mail.ExchangeException: The request failed. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ----> Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ----> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ----> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
— End of inner ExceptionDetail stack trace —
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.Exchange.WebServices.Data.EwsHttpWebRequest.Microsoft.Exchange.WebServices.Data.IEwsHttpWebRequest.GetResponse() in \REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\EwsHttpWebRequest.cs:line 113
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) in \REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\Requests\ServiceRequestBase.cs:line 821
— End of inner ExceptionDetail stack trace —
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) in \REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\Requests\ServiceRequestBase.cs:line 831
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request) in \REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\Requests\ServiceRequestBase.cs:line 724
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest1.Execute() in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\Requests\MultiResponseServiceRequest.cs:line 157 at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToFolder(FolderId folderId, PropertySet propertySet) in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\ExchangeService.cs:line 278 at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToFolder[TFolder](FolderId folderId, PropertySet propertySet) in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\ExchangeService.cs:line 295 at UiPath.Mail.EmailFolderService.FromWellKnownFolderName(String path, String sharedMailBox, ExchangeService exchangeService) --- End of inner ExceptionDetail stack trace --- at UiPath.Mail.Exchange.Activities.ExchangeActivity1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Hi All,
I’m also getting the below error.
Exception message:The request failed. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Exception source:Get Exchange Mail Messages
Exception type:Microsoft.Exchange.WebServices.Data.ServiceRequestException

But, it’s working in my machine and not working when I executed the same in VM.

Please anyone assist me on this.Thanks in Advance.

I solved this issue but i dunno why its solved. :upside_down_face:

The infra team give me two proxy to connect to internet:
1st proxy network segment is same with Robot (Development Farm)
2nd proxy network segment is different with Robot (Production Farm)

This error happened when I’m using Network with different segment.
After I change to network with same segment, it works perfectly.
I believe the issue isn’t about segment, but its about DNS Server, because Infra team told me the proxy has different DNS Server.

Hi @alexologica,

Do you have solution for this,previously with my exchange server address i can able to send emails.But with same address I am getting the same error:
RemoteException wrapping Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The request was aborted: Could not create SSL/TLS secure channel. —> RemoteException wrapping System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.GetResponse()