public string SendMailUseGmail() { int recid = GameRequest.GetInt("taskid", 0); string systemname = GameRequest.GetQueryString("platform"); string sql = string.Format(@" select npct.RecID as taskid,gi.GameDisplayName,u.Compellation,npct.CollectDatetime,dpf.PlatformDisplayName from [{1}] npct inner join sdk_DefaultPlatform dpf on npct.RecID={0} and npct.PlatFormID=dpf.Id inner join sdk_GameInfo gi on npct.GameID=gi.GameID inner join AspNetUsers u on npct.CreateUser=u.Email", recid, systemname == "Android" ? "sdk_NewPackageCreateTask" : "sdk_NewPackageCreateTask_IOS"); DataSet ds = aideNativeWebFacade.GetDataSetBySql(sql); string createuser = ""; string gamename = ""; string platformname = ""; if (ds.Tables[0].Rows.Count > 0) { createuser = ds.Tables[0].Rows[0]["Compellation"].ToString(); gamename = ds.Tables[0].Rows[0]["GameDisplayName"].ToString(); platformname = ds.Tables[0].Rows[0]["PlatformDisplayName"].ToString(); } string toMail = GameRequest.GetQueryString("platform") == "Android" ? System.Configuration.ConfigurationManager.AppSettings["SDKPackageLoseEmail_Android"] : System.Configuration.ConfigurationManager.AppSettings["SDKPackageLoseEmail_IOS"]; string subject = string.Format("打包任务失败({0},{1},{2},{3},{4})", recid, gamename, systemname, platformname, createuser);//邮件标题 string context = GetErrorLog(ds); return(SendEamil.SendMailUseGmail(toMail, subject, context)); }
protected void Forgot(object sender, EventArgs e) { if (IsValid) { // 验证用户密码 var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); ApplicationUser user = manager.FindByName(Email.Text); if (user == null || !manager.IsEmailConfirmed(user.Id)) { FailureText.Text = "用户不存在或未确认。"; ErrorMessage.Visible = true; return; } // 有关如何启用帐户确认和密码重置的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=320771 // 发送包含此代码和重定向到“重置密码”页的电子邮件 string code = manager.GeneratePasswordResetToken(user.Id); code = Server.UrlEncode(code); string callbackUrl = IdentityHelper.GetResetPasswordRedirectUrl(code); string context = "您刚申请了打包平台密码重置,请通过单击 <a href=\"{0}\">此处</a> 来重置你的密码。如非本人申请请勿点击链接。"; //manager.SendEmail(user.Id, "重置密码", "请通过单击 <a href=\"" + callbackUrl + "\">此处</a> 来重置你的密码。"); string message = SendEamil.SendMailUseGmail(Email.Text, code, callbackUrl, context);//SendEamil.SendEmail(Email.Text, code, callbackUrl, context); this.FailureText.Text = message; ErrorMessage.Visible = true; } }
protected void CreateUser_Click(object sender, EventArgs e) { var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); var user = new ApplicationUser() { UserName = Email.Text, Email = Email.Text }; IdentityResult result = manager.Create(user, Password.Text); if (result.Succeeded) { IdentityHelper.SignIn(manager, user, isPersistent: false); // 有关如何启用帐户确认和密码重置的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=320771 string code = manager.GenerateEmailConfirmationToken(user.Id); code = Server.UrlEncode(code); string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id); //manager.SendEmail(user.Id, "渠道打包平台注册邮件地址确认", "您刚申请了渠道打包平台账号,请通过单击 <a href=\"" + callbackUrl + "\">此处 </a> 来确认你的帐户。如非本人申请请勿点击链接。"); string context = "您刚申请了打包平台账号,请通过单击 <a href=\"{0}\">此处 </a> 来确认你的帐户。如非本人申请请勿点击链接。"; string SendMail = SendEamil.SendMailUseGmail(user.Email, code, callbackUrl, context); if (SendMail == "验证邮件发送失败") { FailureText.Text = SendMail; ErrorMessage.Visible = true; } else { IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response); } } else { FailureText.Text = result.Errors.FirstOrDefault(); ErrorMessage.Visible = true; } }