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个参数分别是发件人地址(可以随便写),发件人姓名,编码*/
 
相关文档:
ASP.NET vs. PHP,哪个更快?
http://www.infoq.com/cn/news/2009/09/aspnet-php-benchmark
作者 赵劼 发布于 2009年9月15日 上午5时33分
社区 .NET 主题 性能和可伸缩性 标签 PHP, ASP.NET
结论:
我们可以这么认为,对于纯粹的PHP执行性能来说,Linux和Windows相差 ......
1.Application:用于保存所有用户共用的数据信息。 在Asp.Net中类似的配置数据最好保存在Web.config文件中。如果使用Application对象,一个需要考虑的问题是任何写操作都要在 Application_OnStart事件(global.asax)中完成。尽管使用Application.Lock和 Application.Unlock方法来避免写操作的同步,但是它串行化了Applicat ......
ASP.NET编程的十大技巧
发布日期:2008-08-03
1、在使用Visual Studio .NET时,除直接或非引用的对象外,不要使用缺省的名字
.NET带来的好处之一是所有的源代码和配置文件都是纯文本文件,能够使用Notepad或WordPad等任意的文本编辑器进行编辑。如果不愿 意,我们并非一定要使用Visual Studio .NET作为集成开发环境。 ......
实现ASP.NET生成随机密码功能是很容易的,下面的代码给出了完整的实现方法:
public static string MakePassWord(string PwdChars, int Pwdlen)
{
string mpstr = "";
int iRandNum;
Random mrnd = new Random();
for (int ......