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
<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
string strServerAddress = ConfigurationManager.AppSettings["ServerAdd"].toString();
string strPort = ConfigurationManager.AppSettings["Port"].toString();
mark as answer if solves your problem.