如何在Web配置文件中配置邮件设置 [英] How to configure mail setting in web config file
本文介绍了如何在Web配置文件中配置邮件设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在Web配置文件中配置smtp邮件设置,并想在页面后面的代码中调用它.
谢谢
莫哈末Wasif
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
推荐答案
解决方案1)上面有一篇不错的文章.
http://www.4guysfromrolla.com/articles/072606-1.aspx [ ^ ]
解决方案2)您可以按以下方式在web.config中添加密钥
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.
< small>< big>< pre>< pre lang ="c#"</pre></pre> ;</big></small>
<small><big><pre><pre lang="c#"></pre></pre></big></small>
这篇关于如何在Web配置文件中配置邮件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文