using System.web.Mail;
MailMessage msg = new MailMessage();
//發送方地址(如[email protected])
msg.From = "[email protected]";
//接收方地址(如[email protected])
msg.To = "[email protected]";
//正文內容類型
msg.BodyFormat = MailFormat.Html;
//正文內容編碼
msg.BodyEncoding = System.Text.Encoding.Default;
//主題
msg.Subject = "張大宇向您問好";
//內容
msg.Body = "<html><head><META content=zh-cn http-equiv=Content-Language><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><style type=text/CSS>A:link { FONT-SIZE: 9pt; TEXT-DECORATION: none; color: #000000}A:visited {FONT-SIZE: 9pt; TEXT-DECORATION: none; color: #666666}A:hover {COLOR: #ff6600; FONT-SIZE: 9pt; TEXT-DECORATION: underline}BODY {FONT-SIZE: 9pt} --></style></head><body><font color=red>用戶名:" + UserName.Text.Trim() + "</font><br><font color=green>密碼:" + strUserPsw.ToString() + "</font><br><b>驗證地址:</b><a href='http://192.168.1.98/AllFiles/Member/CheckFromEmail.aspx?UserName=" + UserName.Text.Trim() + "'target=_blank>http://192.168.1.98/AllFiles/Member/CheckFromEmail.ASPx?UserName=" + UserName.Text.Trim() + "</a>。如果您不能點擊鏈接進行跳轉,請把這個地址粘貼到浏覽器的地址欄直接訪問。<br><font color=red>此郵件不必回復,謝謝。</font></body></Html>";
//設置為需要用戶驗證
msg.FIElds.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//設置驗證用戶名
msg.FIElds.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "zdyguilong");
//設置驗證密碼
msg.FIElds.Add("http://schemas.microsoft.com/cdo/configuration/sendpassWord", "123456");
//郵件服務器地址(如smtp.163.com)
SmtpMail.SmtpServer = "smtp.163.com";
//發送
SmtpMail.Send(msg);
//Response.Write("<script language='Javascript'>alert('注冊成功');window.location='../default.ASPx'</script>");