发送验证链接到asp.net中的用户电子邮件 [英] send a verification link to user email in asp.net

查看:72
本文介绍了发送验证链接到asp.net中的用户电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在asp.net中向用户电子邮件发送验证链接

how to send a verification link to user email in asp.net

推荐答案

这可以通过多种方式完成(可能因业务要求而异).

以下可能是一种方法:
1.为该用户生成一个验证唯一ID
2.创建一个页面以检查验证,验证后您可以在该页面上显示消息(成功/失败).
3.通过添加验证ID作为查询字符串,向用户发送到上一页的链接的电子邮件(您可以在此处添加ligic编码).
4.用户单击验证链接后,立即在此处读取查询字符串并编写验证逻辑.
5.根据上述验证逻辑显示消息.

希望对您有帮助.

〜Amol
This can be done in many ways (may vary on business requirements).

Following can be one way:
1. Generate a verification unique id for that user
2. Create a page to check verification on which you can show message after verification (successful/failed).
3. Email user the link to above page by adding verification id as query string (you can add encoding ligic here).
4. As soon as user clicks on verification link, read querystring and write your verification logic here.
5. Show message based on above verification logic.

Hope this will help you.

~Amol


在按钮上单击:
On button click:
MailMessage mm = new MailMessage();
        mm.To.Add(new MailAddress("yourwebsitemailchecker@gmail.com", "Request for Verification"));
        mm.From = new MailAddress("yourwebsitemailid@gmail.com");
        mm.Body = "click here to verify fgdfgdfgdfgdfgdfgdfgfdg";
        mm.IsBodyHtml = true;
        mm.Subject = "Verification";
        SmtpClient smcl = new SmtpClient();
        smcl.Host = "smtp.gmail.com";
        smcl.Port = 587;
        smcl.Credentials = new NetworkCredential("yourwebsitemailid@gmail.com", "yourmailpasswrod");
        smcl.EnableSsl = true;
        smcl.Send(mm);


在上面,您必须检查querystring custid中的邮件检查器

那么您可以检查您的网站邮件检查器中是否包含带有该ustid mailid的收件箱
如果存在,则表示用户已验证;如果不遵循,则再发送一次验证.


In the above you''ve to check mail checker in querystring custid

then you can check that yourwebsitemailchecker for inbox with that custid mailid
If it exists means that user verified If not follow one more send verification


这篇关于发送验证链接到asp.net中的用户电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆