Free Support Forum - aspose.com

Warning CS0612: 'SmtpClient.AuthenticationMethod' is obsolete


#1

Hi,

We upgraded our product to use Aspose.Email Net from 6.1 to 18.2, and have the following warning message during compilation:
warning CS0612: ‘SmtpClient.AuthenticationMethod’ is obsolete
warning CS0612: ‘SmtpAuthentication’ is obsolete

The problem is that there is no further information either from the warning message or the API documentation about what should I do for the obsolete property, is this function been totally removed, or is it been replaced by other class or property?

 private static void SendEmailMessage(MailMessage cleanedMessage)
        {
            SmtpClient smtpclient = new SmtpClient();
            smtpclient.AuthenticationMethod = SmtpAuthentication.Auto;
            smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network;
            string smtpHost = ConfigurationManager.AppSettings["SMTPHOST"];
            if (String.IsNullOrEmpty(smtpHost))
            {
                throw new VfeOnlineException("Smtp host entry is missing from web.config.");
            }
            // if no entry in the web.config the port will be converted as 0
            Int32 smtpPort = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPORT"]);
            smtpclient.Host = smtpHost;
            smtpclient.Port = smtpPort;
            smtpclient.Send(cleanedMessage);
        }

#2

@DougT

In latest versions of API, there is no need to mention AuthenticationMethod however, you may need to mention SecurityOptions or SupportedEncryption. Please find more details at this link:
https://docs.aspose.com/display/emailnet/Sending+and+Forwarding+Messages

Moreover, please feel free to write back to us if you need additional information.


#3

Hi MuzammilKhan,

Thanks for the help, yes, remove the AuthenticationMethod seems working fine.


#4

@DougT

Thank you for your feedback.

We are glad to know that your problem is resolved. Please feel free to write back to us if you have more queries in future.