日期:2014-05-20 浏览次数:21127 次
protected void cmdOk_Click( object sender, EventArgs e ) { MailMessage mail = new MailMessage(); string mailfrom1 = System.Configuration.ConfigurationManager.AppSettings["mailfrom"].ToString(); string mailto1 = System.Configuration.ConfigurationManager.AppSettings["mailto"].ToString(); string mailpwd1 = System.Configuration.ConfigurationManager.AppSettings["mailpwd"].ToString(); mail.To = mailto1; //接受人的邮箱 mail.From = mailfrom1; //你自己的邮箱(注意qq邮箱不行) mail.Subject =this.title.Text(前台表单用户输入); //邮箱标题 mail.Body = "正文:" + this.Content.Text(前台表单用户输入); mail.Body += "联系人邮箱:" + this.Email.Text(前台表单用户输入); mail.Body += "联系人姓名:" + this.LinkMan.Text(前台表单用户输入); 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", mailfrom1 ); mail.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword", mailpwd1 ); SmtpMail.SmtpServer = "pop.ym.163.com"; //代理邮件服务器 SmtpMail.Send( mail ); this.Page.ClientScript.RegisterStartupScript( this.GetType(), "str", "<script>alert(\"提交成功!\")</script>" ); bind(); }
------解决方案--------------------