gpt4 book ai didi

asp.net - 48 小时后在 asp.net 中过期确认电子邮件

转载 作者:行者123 更新时间:2023-12-02 05:19:31 26 4
gpt4 key购买 nike

我向我的用户发送了一封确认电子邮件,当他们点击它时,他们的帐户将被激活。我唯一想要的是在 48 小时后使链接过期,用户可以使用该 username 再次注册。有谁能够帮助我?这是我的电子邮件代码:

   Session["UserName"] = TextBox_email.Text;

MailMessage msg = new MailMessage();
StringBuilder bodyMsg = new StringBuilder();

MembershipUser user = Membership.CreateUser(TextBox_email.Text, TextBox_Pass.Text, TextBox_email.Text);

Roles.AddUserToRole(TextBox_email.Text, "Author");
user.IsApproved = false;
Membership.UpdateUser(user);

// StringBuilder bodyMsg = new StringBuilder();

Guid userID = (Guid)user.ProviderUserKey;


msg.Subject = "Submission Confirmation";
bodyMsg.Append("<html><head><img src=" + "http://waag.ir/images/header.jpg" + ">" + "<title>CONFIRMATION EMAIL:</title></head><body>");
bodyMsg.Append("<br/>");
string link = string.Format("http://www.waag.ir/Activate.aspx?userID={0}", userID.ToString());
bodyMsg.Append("Dear " + RadioButtonList_Prefix.SelectedItem.Text + " " + name.Text + " " + middle.Text + " " + lastname.Text + ":<br> Thank you for registering with Avestia Publishing manuscript submission system. To confirm and complete your registration, please follow the link below:</br>" + link + "</br>This link is active for 48 hours. If the link is not visited within this time frame, your registration will be discarded and you will need to register again.</br></br></br>Best regards,</br>Avestia Publishing</br>http://avestia.com");

msg.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8");
msg.Priority = MailPriority.High;

msg.Body = bodyMsg.ToString();
msg.IsBodyHtml = true;
msg.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8");
msg.Priority = MailPriority.High;

// msg.ReplyTo = new MailAddress(TextBox2.Text);
msg.From = new MailAddress("goldenstudio@goldenstudio.ir");
msg.To.Add(new MailAddress(TextBox_email.Text));
SmtpClient mailsender = new SmtpClient();

mailsender.Host = "SmtpClient.goldenstudio.ir";

mailsender.Port = 587;
mailsender.EnableSsl = true;
mailsender.Credentials = new System.Net.NetworkCredential("goldenstudio@goldenstudio.ir", "classaspnet");

SmtpClient smtp = new SmtpClient();
//Literal1.Text = "<script>alert(' ')</script>";
smtp.Send(msg);

最佳答案

在您的 Users 表(我假设您有一个)中添加一个名为 ConfirmationDueDate 的列,并将其设置为从用户单击 开始的 48 小时确定 创建帐户。当用户点击链接时,如果当前时间超过了 ConfirmationDueDate 值,则将他们带回帐户创建页面。

关于asp.net - 48 小时后在 asp.net 中过期确认电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14104872/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com