public int SendResetEmail(string email) { OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory(); OxcoderIDAL.UserIDAL dalad = factory.getUserInstance(); OxcoderIDAL.EnterpriseInfoIDAL en = factory.getEnterpriseInstance(); // dalad.SendEmail(id, md5); //TODO:发邮件 MailMessage mailMsg = new MailMessage(); mailMsg.From = new MailAddress("*****@*****.**"); mailMsg.To.Add(email); mailMsg.Subject = "请重置密码"; string activeCode = Guid.NewGuid().ToString().Substring(0, 8); StringBuilder contentBuilder = new StringBuilder(); contentBuilder.Append("请点击下面的链接完成密码重置"); contentBuilder.Append("<a href='http://*****:*****@qq.com", "hmh299222"); int state = 0; //判断用户类型 if (dalad.CheckUserEmail(email) == 1) { if (dalad.SendUserEmail(email, activeCode) != 0) { client.Send(mailMsg); state = 1; } else { state = 0; } } else if (en.CheckEnterpriceEmail(email) == 1) { if (en.SendEnterpriceEmail(email, activeCode) != 0) { client.Send(mailMsg); state = 1; } else { state = 0; } } return(state); }
public int SendUserEmail(string emailTo) { OxcoderIFactory.IFactory factory = new OxcoderFactory.SqlSeverFactory(); OxcoderIDAL.UserIDAL dalad = factory.getUserInstance(); // dalad.SendEmail(id, md5); //TODO:发邮件 MailMessage mailMsg = new MailMessage(); mailMsg.From = new MailAddress("*****@*****.**"); mailMsg.To.Add(emailTo); mailMsg.Subject = "请激活注册账号"; string activeCode = Guid.NewGuid().ToString().Substring(0, 8); StringBuilder contentBuilder = new StringBuilder(); contentBuilder.Append("请点击下面的链接完成激活注册"); string type = "User"; contentBuilder.Append("<a href='http://*****:*****@qq.com", "hmh299222"); if (dalad.SendUserEmail(emailTo, activeCode) != 0) { client.Send(mailMsg); return(1); } else { return(0); } }