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.
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);



Read SMTP settings from asp.net web.config | Tea Break said,
July 16, 2008 @ 4:21 pm
[...] This cup of tea was served by: Najam Sikander [...]
John chaffee said,
December 16, 2008 @ 4:39 pm
Oh Man…thank you so much for posting! I have been working non this for about 4 hours. I neglected the opening of the file. This solution worked right out of the box once I included the proper namespaces. This was the only place on the web i found with a clear code example. Once again, thank you.
Sithira said,
July 30, 2009 @ 10:12 pm
Thanx mate. was very usefull. Luckily I got ur post on the top at google.