Hi Remy,
Hi,
Thank you for further details.
I am able to reproduce exactly the same error on my end [Windows 7 64bit]. But I have also noticed, this error has nothing to do with Aspose.Email for .NET assembly. If you execute only the below source code line without utilizing any object from Aspose.Email Namespace, still you get the same error. I am looking into it further for better answers.
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
Meanwhile, I have a workaround for this problem. Please check the below source code and attached sample application for your reference. I have removed the Aspose.Email.dll file to decrease the archive size.
Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
MailSettingsSectionGroup settings = (MailSettingsSectionGroup)config.GetSectionGroup(“system.net/mailSettings 1”);
SmtpSection smtp = settings.Smtp;
SmtpNetworkElement network = smtp.Network;
SmtpClient client = new SmtpClient(network.Host, network.Port, network.UserName, network.Password);
Hi,
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
MailSettingsSectionGroup settings = (MailSettingsSectionGroup)config.GetSectionGroup(“system.net/mailSettings”);
SmtpSection smtp = settings.Smtp;
SmtpNetworkElement network = smtp.Network;
SmtpClient client = new SmtpClient(network.Host, network.Port, network.UserName, network.Password);
Thanks, we’ve used something similar with your old Network Library. We also use the SpecifiedPickupDirectory settings. I just figured it would be nice to automatically set all the settings at once.
Has this been addressed yet? Your workaround is certainly a lot more verbose than necessary, since in Asp.Net you can normally use System.Net.Mail.SmtpClient.
Hi Charles,
Hi Charles,
Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
SmtpClient client = new SmtpClient(config);
MailMessage message = new MailMessage();
message.From = “sender@domain.com”;
message.To = “receiver@aspose.com”;
message.HtmlBody = “Hello there”;
client.EnableSsl = true;
client.Send(message);
Thanks, I’ll try that as soon as I get a chance. However, I believe we are using 1.9, and when I tried that I got an exception on the “OpenWebConfiguration” method. I’ll try it again just to be sure.