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>");
新闻热点
疑难解答
图片精选