日期:2014-05-20  浏览次数:20453 次

大虾 谁会? 谢谢给分
我想做个网页   在上面点击审核按钮  
会自动发送一个邮件给某个的人!怎么实现这个呢?

------解决方案--------------------
看看ASP.NET方面发邮件的例子
------解决方案--------------------
http://blog.joycode.com/ghj/archive/2005/10/01/64458.aspx

http://www.aspxboy.com/490/default.aspx
------解决方案--------------------
蹭分
------解决方案--------------------
using System;
using System.Web.Mail;

namespace LiveMessage.Common
{
/// <summary>
/// SendMail 的摘要说明。
/// </summary>
public class SendMail
{
public SendMail()
{
//
// TODO: 在此处添加构造函数逻辑
//
}

public static bool sendMail(string from,string to,string subject,string body,string smtpaccountname,string sendusername,string sendpassword,string smtpServer)
{
try
{
MailMessage mm=new MailMessage();
mm.BodyFormat=MailFormat.Html;
mm.From=from;
mm.To=to;
mm.BodyEncoding=System.Text.Encoding.GetEncoding(936);
mm.Subject=subject;
mm.Body=body;
mm.Fields[ "http://schemas.microsoft.com/cdo/configuration/sendusing "] = 2;
mm.Fields[ "http://schemas.microsoft.com/cdo/configuration/smtpaccountname "] = smtpaccountname;
mm.Fields[ "http://schemas.microsoft.com/cdo/configuration/sendusername "] = sendusername;//验证账号:发送者邮箱账号
mm.Fields[ "http://schemas.microsoft.com/cdo/configuration/sendpassword "] = sendpassword; //验证密码:发送者邮箱密码
mm.Fields[ "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate "] = 1; //验证级别0,1,2
mm.Fields[ "http://schemas.microsoft.com/cdo/configuration/languagecode "] = 0x0804;//语言代码
System.Web.Mail.SmtpMail.SmtpServer=smtpServer;//上句和这句重着,这句可以替代上句
System.Web.Mail.SmtpMail.Send(mm);
return true;
}
catch
{
return false;
}
}
}
}

------解决方案--------------------
try
{
MailMessage mail = new MailMessage();
//发送方的地址
mail.From = "。。。。 ";
//接受方的地址
mail.To = "。。。。 ";
//发送的内容的类型
mail.BodyFormat = MailFormat.Text;
//正文内容的编码
mail.BodyEncoding = System.Text.Encoding.Default;
//正文的主题
mail.Subject = "。。。。 ";
//正文的内容
mail.Body = "。。。。。 ";

//设置为需要用户验证
mail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ", "1 ");
//设置验证用户名
mail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername ", "。。。 ");
//设置验证密码
mail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword ", "。。。 ");

//邮件服务器地址(如smtp.163.com)
SmtpMail.SmtpServer = "smtp.163.com ";
//发送
SmtpMail.Send(mail);
//显示成功发送
Response.Write( " <script language= 'javascript '> alert( '注册成功 ');window.location= '../default.aspx ' </script> ");
}
catch
{ }
------解决方案--------------------