EnableSsl is deprecated- what is the replacement?

Hi,



I’ve upgraded Aspose.Email from 3.4.0 to 4.3.0.



And since it tells me that IsEnableSsl is deprecated.



I use the following code :

// Set SMTP client

_smtpClient = new SmtpClient(mailInstance.Address, mailInstance.Port.GetValueOrDefault(25), mailInstance.Username, mailInstance.Password);

_smtpClient.EnableSsl = mailInstance.IsSslRequired.GetValueOrDefault(false);



What was the old behaviour of EnableSsl flag (SecurityOptions.SSLExplicit or SecurityOptions.SSLImplicit ?)



Also, the Aspose.Email documentation on the website is really not uptodate :frowning:

Hi,


I have analyzed the requirement and observed that old default behavior of EnableSsl was false and SecurityOptions.SSLImplicit. In the new version 4.3, if we set SecurityOptions.SSLImplicit it translates to SmtpSslSecurityMode.Implicit and for SecurityOptions.SSLExplicit, the SmtpSslSecurityMode.Explicit is set.

I would like to thank you for pointing out the documentation issue and we will update it soon.

Sorry, my previous email wasn’t clear enough, my question was :

EnableSsl = true match with which option :

SecurityOptions.SSLExplicit or SecurityOptions.SSLImplicit ?

Hi,

Thank you for writing to us again. I would like to share that as EnableSSL property is deprecated, so you don’t need to take care of it. Only port and SmtpClient.SecurityOptions need to be set to SSLImplicit or SSLExplicit based upon the server settings being connected. You may please have a look at the following for more detail on SSLExplicit and SSLImplicit:

[Using an SMTP server with SSL ](http://help.fogcreek.com/9002/using-an-smtp-server-with-ssl)

[System.Net.Mail with SSL To Authenticate Against Port 465 ](http://blogs.msdn.com/b/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx)

Please feel free if you have any other query related to Aspose.Email.

Hi!

I have the same issue. Could you tell me, is the option "SecurityOptions.Auto" mean automatic choice between "SecurityOptions.Impicit" and "SecurityOptions.Expicit" without "SecurityOptions.None"?

Thanks!

Hi Sergey,

SecurityOptions.Auto means automatic choice between all three options, i.e.:

  • SecurityOptions.Impicit
  • SecurityOptions.Expicit
  • SecurityOptions.None (not secured connection)
Please let us know if we can be of any additional help to you in this regard.

Hi! Thanks for your respond!

One more question. I use IMAP4 connection with SSL, without specifying a port. And it works. Is it really IMAP or it automatically changed to another protocol?

Hi Sergey,


I have discussed the matter with developers and they have informed that it is IMAP which uses default port for connection.

Please feel free to write us back if you have any other query in this regard.

Ok, Thanks you very much!

Hi Kashif!
Could you help me one more time, please.
I’m trying to send messages using SMTP, and there is a success with specifying both 25 and 587 port numbers, but only after calling SmtpClient.GetCapabilities() method. If I don’t call this method before message sending there is an Exception “The server committed a protocol violation.” Do you know, why it is?

Hi Sergey,


I have tested the scenario again and have successfully sent mail via SMTP without using SmtpClient.GetCapabilities() function. Could you please send us the complete project which can be compiled and executed here to re-produce the scenario? It will help us to provide assistance as soon as possible.