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 + 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>");
新聞熱點
疑難解答
圖片精選