Search code examples
phpemailextjsregistration

How to send verification email after registration form in extjs


How verification email is sent to user after filling in registration form? 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. In this context, I don't understand two things:

  1. How to send verification email, and
  2. What happens, when user clicks on that email and confirms. 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. But how to achieve this with additional confirmation email?

enter image description here


Solution

  • 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.
    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.
    3. You can use swiftmail framework to send emails with html or just simple text.