Open In App

How to Send a User Verification Mail in Web and Firebase ?

Last Updated : 31 Oct, 2022
Like Article

In this article, we will see how to send the user verification email to the user, so that only verified users can be signed In to their account using Email Password Authentication. 

The Drawback of email password authentication is that, when a user signs up using an arbitrary email, firebase allows them to sign up and sign in, Unlike email is arbitrary.

So, A verification email sends to the user, so that we can verify that the email really belongs to that user.

A sample video gives you an idea of what we are going to implement in this article:


Syntax: Send User a Verification Email:

function VerificationEmail() {
       .then(() => {
           // Email verification sent!
           console.log('Email Verification sent! Check your mail box');
           // ...

Example: Below is the implementation to Send a user Verification mail in Web and Firebase

  • index.html: The HTML file contains only two buttons that call the respective method, showUserProfile, and VerificationEmail.


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" 
    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0">
    <script src=
    <script src="/app.js"></script>
    <button onclick="showUserProfile1()"
      Show user Profile data using provider</button>
        <button onclick="VerificationEmail()">
          Sent Verification Email</button>

  • script.js: Javascript file contains the firebase configure file and the Function definition for the method showUserProfile and VerificationEmail


const firebaseConfig = {
    //your configuration code here
// Initialize Firebase
const app = firebase.initializeApp(firebaseConfig);
function showUserProfile1() {
    const user = firebase.auth().currentUser;
    if (user !== null) {
        user.providerData.forEach((profile) => {
            console.log("Sign-in provider: " + profile.providerId);
            console.log(" Provider-specific UID: " + profile.uid);
            console.log(" Name: " + profile.displayName);
            console.log(" Email: " +;
            console.log(" Photo URL: " + profile.photoURL);
// Method to send the user verification mail
function VerificationEmail() {
        .then(() => {
            // Email verification sent!
            console.log('Email Verification sent! Check your mail box');
            // ...



Check out your Mailbox to verify the mail, If you did not find the email, check the junk folder, Spam:


Now your firebase application only allows signing in to the user who has the verified email.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads