Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have to configure smtp mail setting in web config file and want to call that in code behind of a page .


thanks
Mohd. Wasif
Posted

Solution 1) there is a good article on it.

http://www.4guysfromrolla.com/articles/072606-1.aspx[^]



Solution 2) you can add your keys in web.config as follows
XML
<appSettings>
      <add key="ServerAdd" value="172.101.50.10" />
      <add key="Port" value="25" />
      <add key="FromEmail" value="abc@abcd.com" />
</appSettings>


which later you can access in code behind as follows

C#
string strServerAddress = ConfigurationManager.AppSettings["ServerAdd"].toString();
string strPort = ConfigurationManager.AppSettings["Port"].toString();



mark as answer if solves your problem.
 
Share this answer
 
<small><big><pre><pre lang="c#"></pre></pre></big></small>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900