简体   繁体   English

如何在 extjs 中的注册表格后发送验证 email

[英]How to send verification email after registration form in extjs

How verification email is sent to user after filling in registration form?填写注册表后如何将验证email发送给用户? Let's say that I have a registration form as given in picture, and I would like to send the verification email to email entered in the form, so only after user confirms it, I can create new record in MySql database.假设我有一个如图所示的注册表单,我想将验证 email 发送到表格中输入的 email,所以只有在用户确认后,我才能在 Z9DF306F03DAEDCCF83F5E2928 数据库中创建新记录。 In this context, I don't understand two things:在这种情况下,我不明白两件事:

  1. How to send verification email, and如何发送验证 email 和
  2. What happens, when user clicks on that email and confirms.当用户点击 email 并确认时会发生什么。 How in that case server knows that verification was successful, and how new user is created in database.在那种情况下,服务器如何知道验证成功,以及如何在数据库中创建新用户。 I know that in case of classic registration, if all fields are correct, a PHP code is used to create new record in database for that user.我知道在经典注册的情况下,如果所有字段都正确,则使用 PHP 代码在数据库中为该用户创建新记录。 But how to achieve this with additional confirmation email?但是如何通过额外的确认 email 来实现这一点?

在此处输入图像描述

I can provide you with simple solution:我可以为您提供简单的解决方案:

  1. Create an function that will send an email with text and some link like: www.site.com/activate.php?random=ng8a8712jh3j Where activate.php is your script which will get the randomly generated code and will match it with this specific email/user, and will set the status as activated. Create an function that will send an email with text and some link like: www.site.com/activate.php?random=ng8a8712jh3j Where activate.php is your script which will get the randomly generated code and will match it with this specific email /user,并将状态设置为已激活。
  2. Create an extra field into your table where the registration is going, and name it like user_status and you may assign default value of inactive or 0 and as soon as the user opens the link you will match the random code with the user ID and set the user_status to active or 1.在要进行注册的表中创建一个额外字段,并将其命名为 user_status ,您可以指定默认值 inactive 或 0 ,一旦用户打开链接,您就会将随机代码与用户 ID 匹配并设置user_status 为活动或 1。
  3. You can use swiftmail framework to send emails with html or just simple text.您可以使用 swiftmail 框架发送带有 html 或简单文本的电子邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM