Asp.net(c#)发送电子邮件

80酷酷网    80kuku.com

  asp.net

using System.web.Mail; 

            MailMessage msg = new MailMessage();
            //发送方地址(如)
            msg.From = "";
            //接收方地址(如)
            msg.To = "";
            //正文内容类型
            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>
<font color=green>密码:" + strUserPsw.ToString() + "</font>
<b>验证地址:</b><a language='javascript'>alert('注册成功');window.location='../default.aspx'</script>");

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: