Free Support Forum - aspose.com

Pop3/ImapClient: what protocols are specified when connecting?

Using Pop3Client & ImapClient: is just the .NET default protocol (TLS 1.2) used when connecting to the mail server or all the supported protocols on the client machine? If SslStream is being used then I would guess some variant of AuthenticateAsClient is used to connect. The .NET default can be assumed in that call or protocols can be specified like TLS 1.0, 1.1, 1.2 so the mail server can pick one from the list.

@Karlspose

Aspose.Email implements a number of network protocols, for example SMTP, MIME, POP3 and IMAP. Every protocol have its own mechanism to communicate and authenticate. Which protocol shall be used is based on the needs of the user.

For more information regarding Protocols, Please follow the links given below:
https://docs.aspose.com/display/emailnet/Protocol+Information
https://docs.aspose.com/display/emailnet/Difference+between+POP3+and+IMAP

Thanks for the response. I’m referring specifically to the Pop3Client and ImapClient classes and the SSL protocol they are using for authentication.

@Karispose

Please find below the sample Code for connecting ImapClient with SSL:

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET
// Create an instance of the ImapClient class
ImapClient client = new ImapClient("imap.domain.com", 993, "user@domain.com", "pwd");
            
// Set the security mode to implicit
client.SecurityOptions = SecurityOptions.SSLImplicit;

Please find below the sample Code for connecting Pop3Client with SSL:

// For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET
// Create an instance of the Pop3Client class
Pop3Client client = new Pop3Client();
// Specify host, username and password, Port and  SecurityOptions for your client
client.Host = "pop.gmail.com";
client.Username = "your.username@gmail.com";
client.Password = "your.password";
client.Port = 995;
client.SecurityOptions = SecurityOptions.Auto; 
Console.WriteLine(Environment.NewLine + "Connecting to POP3 server using SSL.");

I really appreciate the detailed response. I believe my answer is in the SecurityOptions setting. I see it can be None, SSLExplicit, SSLImplicit, SSLAuto and Auto. I just can’t tell from the documentation on those settings if it’s trying to negotiate all of the SSL/TLS versions available on the client machine or just one which I would expect to be the .NET default. For example, .NET 4.6 and up I believe defaults to TLS 1.2. Then, if that isn’t supported does the call / connection fail or are several protocols passed to the mail server (1.0, 1.1, 1.2) so the server can pick?

@Karispose

Aspose.Email does not try to communicate with all SSL/TLS versions available. Our components use .NET Framework security classes. So latest version of the .NET Framework provides the latest version of SSL implementation. It is necessary that Server and client must support the same versions of SSL protocol. To set SSL version for client you may use following code:

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

2 Likes