除了以上做法还可以直接写一个文件不改动web.config也可以代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using
public partial class emailSend : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
MailMessage mail = new MailMessage();
mail.To.Add(new MailAddress("qwlin1@,"qwlin1"));//别人的邮箱地址
mail.From = new MailAddress("lierlqw@,"我的第一封信");//自己的邮箱地址
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
mail.Priority = MailPriority.High;//邮件的紧急程度
client = new SmtpClient();
client.Credentials = new ("lierlqw","你的密码");
client.Host = "smtp.邮箱地址
client.Send(mail);
}
catch ( ex)
{
Response.Write(ex.Message);
}
}
}
[[it] 本帖最后由 lqw 于 2008-6-16 14:43 编辑 [/it]]