asp.net中简单的邮件发送,供取回密码!
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Net.Configuration;
namespace BCore.PubFunction
{
public class MailHandler
{
public bool passwordToEmail(string usermail, string newpassword, string loginname)
{
try
{
System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/");
MailSettingsSectionGroup settings = (MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");
System.Net.NetworkCredential credential = new System.Net.NetworkCredential(settings.Smtp.Network.UserName, settings.Smtp.Network.Password);
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
//msg.To.Add("itblackhole@163.com");//可以发送多人
msg.To.Add(usermail);
msg.from = new MailAddress("itblackhole@gmail.com", "*******", System.Text.Encoding.UTF8); /*3个参数分别是发件人地址(可以随便写),发件人姓名,编码*/
相关文档:
1.Application:用于保存所有用户共用的数据信息。 在Asp.Net中类似的配置数据最好保存在Web.config文件中。如果使用Application对象,一个需要考虑的问题是任何写操作都要在 Application_OnStart事件(global.asax)中完成。尽管使用Application.Lock和 Application.Unlock方法来避免写操作的同步,但是它串行化了Applicat ......
if(MyFile.PostedFile.ContentType != "image/gif"
&& MyFile.PostedFile.ContentType != "image/jpg"
&& MyFile.PostedFile.ContentType != "image/pjpeg"
&& &n ......
Asp.Net前台调用后台变量
asp.net 2009-07-11 07:27 阅读220 评论0
字号: 大大 中中 小小
1.Asp.Net中几种相似的标记符号: < %=...%>< %#... %>< % %>< %@ %>解释及用法
答: < %#... %>: 是在绑定控件DataBind()方法执� ......
ASP.NET 生命周期
对于Asp.net页面层开发无论是写页面还是写控件,我觉得都可以用一句话描述:"Do the right thing at the right time in the right place."
本文通过记录页面事件的触发顺序看请求的处理流程,从中可以看出ASP.NET 的生命周期
创建一个网站,在页面上添加一个Label和一个Button,在Default.aspx.cs中修改 ......
最近遇到要读取QQ相册的问题,所以自己诼磨了下,把读取相册的思路和代码写下来。
很多网站到图片链接都做了盗链处理。意思是如果你想在不是他的网站上引用图片就不会正确显示图片,而是一张其它的版权说明之类的图片。实现防盗链的一般做好是通过判断Request的Headers中的Re ......