hi guyz
Sorry for writing after such a long time i guess i am very busy now a days so for a project i needed to read my smtp email settings defined in my web.config file so after some efforts i am able to read these settings direct from my system .net section.
1
2
3
4
5
6
7
|
System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
System.Net.Configuration.MailSettingsSectionGroup settings = (System.Net.Configuration.MailSettingsSectionGroup) config.GetSectionGroup("system.net/mailSettings");
Response.Write("<br>Username="+settings.Smtp.Network.UserName);
Response.Write("<br>Password=" + settings.Smtp.Network.Password);
Response.Write("<br>host=" + settings.Smtp.Network.Host);
Response.Write("<br>port=" + settings.Smtp.Network.Port);
Response.Write("<br>from=" + settings.Smtp.From);
|