Aspose.Email for .NET 5.3 - public API changes

Hello,

I’ve migrated from Aspose.Email 5.2 to Aspose.Email 5.3 and I have obtained several compile-time errors, since my code uses public members, which seems have been removed in the Aspose.Email 5.3.

In particular, class Aspose.Email.Mail.SmtpClient, and its properties: “EnableSsl”, “SecurityMode”. And also enumeration “SmtpSslSecurityMode”. These items are absent in the Aspose.Email 5.3. Please tell me how to achieve the same functionality / access that features with new version of the library.

With best regards,

Denis Gvardioniv

Hi Denis,


Thank you for posting your query.

The changes are because all the obsolete code members have been removed and you need to follow the new methods/members instead of these. With respect to the members related to SmtpClient, you can use the SmtpClient.SecurityOptions for this purpose now. The following code sample can be used for this purpose. If you face any difficulty, please free free to write to us.

Code:

SmtpClient client = new SmtpCleint(host, port, username, password);

client.SecurityOptions = SecurityOptions.Auto;

Hello Muhammad,

Thanks for answering. Can you please tell me what the analogues are for these statements:

1. bool isSslEnabled = instance_SmtpClient.EnableSsl;
How should it be now?
bool isSslEnabled = instance_SmtpClient.SecurityOptions == SecurityOptions.SSLExplicit || instance_SmtpClient.SecurityOptions == SecurityOptions.SSLImplicit;
Is this correct or there is another way?

2. If I wanted to enable SSL, in previous version I did the following:
instance_SmtpClient.EnableSsl = true;
How should I enable SSL now?
instance_SmtpClient.SecurityOptions = SecurityOptions.Auto; ?
Is this correct?

Thanks in advance.

With best regards,

Denis Gvardionov

Hi Denis,

We regret the inconvenience you are facing.

  1. You should use

SmtpClient.SecurityOptions = SecurityOptions.SSLImplicit

for enabling SSL. SSLExplicit is used for TLS and is different than SSL.

  1. Previous we had EnableSsl but now there is only SecurityOptions that can be used to set any mode. The SecurityOptions mode depends on the configuration of server. For example, you can set it to SSLExplicit or Auto which both work for Gmail. The Auto mode usually auto selects the appropriate mode for communication. Further information about Gmail is as follow which shows you have to use SSLExplicit or Auto in case of Gmail. Please try it at your end and share your feedback with us.

Security settings for Gmail

SecurityOptions.SSLImplicit,
“[imap.gmail.com](http://imap.gmail.com/)”,
993,

SecurityOptions.SSLExplicit,
“[smtp.gmail.com](http://smtp.gmail.com/)”,
587,

SecurityOptions.SSLImplicit,
“[pop.gmail.com](http://pop.gmail.com/)”,
995,