The type initializer for 'Aspose.Email.Mail.SmtpClient' threw an exception

Hi,

I am getting error "The type initializer for 'Aspose.Email.Mail.SmtpClient' threw an exception" in below code.

I have used ASpose.Email 2.2.0.0.But stil i am getting same error message.

SmtpClient client = new SmtpClient(network.Host, network.Port, network.UserName, network.Password);///getting error here

client.DeliveryMethod = Aspose.Email.Mail.SmtpDeliveryMethod.Network;

client.AuthenticationMethod = Aspose.Email.Mail.SmtpAuthentication.None;

client.SecurityMode = SmtpSslSecurityMode.Explicit;

client.EnableSsl = true;

client.Send(mailMsg);

Thanks,

Jacintha

Hi Jacintha,


Thank you for using Aspose.Email.

It was a known issue till the version Aspose.Email 2.2.0.0 and we have fixed it recently in our minor release. Please download and try this latest fix of Aspose.Email for .NET 2.2.0.2 and you will find this issue solved.

Please note that this is a minor release but it is as stable as any major release, and will be part of the upcoming version of Aspose.Email for .NET 2.3.0.

Hi,

I am trying to send a email using aspose.email.I am getting the below error message.

"Mailbox unavailable,The server resposne was 5.7.1.Initial access check failure "
Please guide me.

Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(HttpContext.Request.ApplicationPath);
System.Net.Configuration.MailSettingsSectionGroup settings = (System.Net.Configuration.MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");
System.Net.Configuration.SmtpSection smtp = settings.Smtp;
System.Net.Configuration.SmtpNetworkElement network = smtp.Network;
Aspose.Email.Mail.MailMessage mailMsg = new Aspose.Email.Mail.MailMessage();



mailMsg.From = smtp.From;
mailMsg.To = network.TargetName;
mailMsg.HtmlBody = result;
mailMsg.IsBodyHtml = true;
SmtpClient client = new SmtpClient(network.Host, network.Port, network.UserName, network.Password);
client.DeliveryMethod = Aspose.Email.Mail.SmtpDeliveryMethod.Network;
client.AuthenticationMethod = Aspose.Email.Mail.SmtpAuthentication.None;
client.SecurityMode = SmtpSslSecurityMode.Explicit;
client.EnableSsl = true;
client.Send(mailMsg); ///Getting error message here

Thanks,

Jacintha

Hi Jacintha,


We are sorry for a delayed response.

Can you please confirm to us if you are getting the exception with the latest version of Aspose.Email for .NET 2.3.0? This exception was reported by some of our other customers earlier and we have fixed this issue in the latest version mentioned above.

I would request you to please download and try this latest version. If the problem still persists, please provide us your complete runnable Visual Studio project. We will investigate the issue and assist you further.