Port 993
is the TLS/SSL port, so if you try setting server.SSLConnection = true;
does that work?
How to solve Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
PR
0
Reputation points
Created an application to read an outlook mail inbox folder using OAuth2 and EAGetMail nuget package, but while connecting to the server an exception is thrown with innerexception message as 'An existing connection was forcibly closed by the remote host'.
Below is the code block
MailServer server = new MailServer(outlook.office365.com,
officeUserid,
token,
ServerProtocol.Imap4);
server.AuthType = ServerAuthType.AuthXOAUTH2; server.SSLConnection = true;
server.Port = 993;
mailclient.connect(server);
Followed the steps of registering the application in Azure and already having the tenantid,clientid, secret and before connecting to the outlook server able to receive the token as well, but unable to connect to the server due to the error.
Outlook | Windows | Classic Outlook for Windows | For business
9,692 questions
Developer technologies | .NET | Other
4,105 questions
Developer technologies | C#
11,576 questions
1 answer
Sort by: Most helpful
-
P a u l 10,761 Reputation points
2023-06-26T17:47:24.6866667+00:00