想在网站实现订阅邮件发送的功能,订阅的邮件有很多种类的,这个怎么发送?

解决方案 »

  1.   

    if (eastelite.DIP.BLL.staffBll.addregister(staff))
                {
                    Session["reg"] = staff;//存入session
                    MailMessage mail = new MailMessage();
                    staffModel s = Session["reg"] as staffModel;//接收session
                    string mailfrom = System.Configuration.ConfigurationManager.AppSettings["servermailname"].ToString();
                    string mailto = this.mail.Text.ToString().Trim();
                    string mailpwd = System.Configuration.ConfigurationManager.AppSettings["servermailpwd"].ToString();
                    mail.BodyFormat = System.Web.Mail.MailFormat.Html;
                    mail.To = this.mail.Text;  //接受人的邮箱
                    mail.From = mailfrom;  //你自己的邮箱(注意qq邮箱不行)
                    mail.Subject = this.people.Text.ToString() + ",";  //邮箱标题
                    mail.Body = "尊敬的" + this.people.Text + ":<br>感谢您对于本系统的支持与关注!<br>您的注册信息如下:<br>系统帐号:<font color='red'>" + s.Staffcode + "</font><br>系统密码:<font color='red'>"
                        + this.pwd.Text + "</font><br>用户名:<font color='red'>" + this.people.Text + "</font><br>安全邮箱:<font color='red'>" + this.mail.Text
                        + "</font><br>帐号或其他相关问题请登录我们的官网咨询或留言.<font color='red'>请勿回复系统邮件)";
                    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");
                    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //stmp验证
                    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", mailfrom);
                    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", mailpwd);
                    SmtpMail.SmtpServer = "smtp.ym.163.com";  //企业代理邮件服务器
                    SmtpMail.Send(mail);
                    cleartext();//清空文本
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "str", "<script>window.open('regdetatile.aspx',target='_self');</script>");//弹出信息显示页面
                }
    帐号密码在配置文件