在asp.net中使用激活链接注册后如何发送电子邮件 [英] how to send email after registration with activation link in asp.net
本文介绍了在asp.net中使用激活链接注册后如何发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在asp.net中使用激活链接注册后如何发送电子邮件
how to send email after registration with activation link in asp.net
推荐答案
发送电子邮件很容易-这里有一个提示,其中包含代码:使用C#发送带有或不带有附件的电子邮件:通用例程. /a> [ ^ ]
您所要做的就是在电子邮件中使用HTML,并向他们发送带有参数的链接:
Sending the email is easy - there is a tip here with the code: Sending an Email in C# with or without attachments: generic routine.[^]
All you have to do is use HTML in the email send them a link with parameters:
protected void myCreateUserWizard_CreatedUser(object sender, EventArgs e)
{
myCreateUserWizard.LoginCreatedUser = false;
SMUser user = new SMUser(SMUser.FindByUserName(myCreateUserWizard.UserName));
Guid registercode = Guid.NewGuid();
user.VerificationCode = registercode;
user.Update();
StringBuilder sb = new StringBuilder();
sb.AppendFormat("%HTML%#NHi {0}!\n\n Thank you for registering at MYDOMAIN. To complete your registration, please follow the link below:\n\n", user.UserName);
string link = string.Format("http://www.MYDOMAIN.com/Register.aspx?RegistrationCode={0}{1}",
user.Id.ToString(),
registercode.ToString());
sb.AppendFormat(@"<a href=""{0}"">MYDOMAIN.com Complete Registration</a>", link);
sb.Append("\n\nWhen you have followed the link, you will be able to log in and use your account.\n");
sb.Append("If your email system does not allow linking, please copy and paste the following into your browser:\n");
sb.Append(link);
sb.Append("\n\n");
user.SendEmail(sb.ToString());
myCreateUserWizard.CompleteSuccessText = "Thank you for registering!<br />" +
"An email has been sent to the address you provided.<br />" +
"Please follow the link it gives to complete the process.";
}
然后,您读取Register.apsx文件中的参数并将其标记为完成.
You then read the parameters in the Register.apsx file and mark it finished.
http://ctrlf5.net/?p=55 [ ^ ]
http://lspence.blogspot.com/2008/02/sending- activation-email-with-aspnet-20.html [ ^ ]
http://ctrlf5.net/?p=55[^]
http://lspence.blogspot.com/2008/02/sending-activation-email-with-aspnet-20.html[^]
检查这篇文章,它可以解释您的确切情况.
http://www.4guysfromrolla.com/articles/062508-1.aspx [ ^ ]
您还可以在同一网站上找到大量有关该参数的有趣文章.
干杯
Check this article up, it is explaining your exact situation.
http://www.4guysfromrolla.com/articles/062508-1.aspx[^]
You can also find a lot of interesting articles on that argument on the same site.
Cheers
这篇关于在asp.net中使用激活链接注册后如何发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文