MagicJS
mern.aiUniversityGitHub
  • Introduction to MagicJS
  • Why MagicJS?
  • Getting Started & Installation
  • Basic Guide
    • Create a new page using React
    • Navigate between pages
    • Create an API and integrate it with the frontend
    • Authenticate Users
      • Authorise based on Roles
    • Advanced State Management with useContent()
    • Perform CRUD Operations
    • Adding Realtime capabilities using socket
    • Handling file uploads and downloads
  • Advanced Guide
    • Understanding the concept of features in MagicJS
    • Using UI components & functions across multiple Magic Features
    • Advanced Routing of pages
    • Enable SSR
    • Access MongoDB
    • Styling pages using Tailwind CSS
  • Deploying
  • Update MagicJS
  • API References
    • Frontend
      • <LinkDisplay>
      • createSrc()
      • createUploader()
      • importUI()
      • loadConfig()
      • protected()
      • useParams()
      • useAxios()
      • useLogin()
      • useSocket()
      • useContent()
      • usePromise()
      • useNotification()
    • Backend
      • createBackendFunction()
      • data()
      • io()
      • ServerInstance()
      • utils
        • hash()
        • verifyHash()
        • initiateEmailVerification()
        • saveFileToUserUploads()
        • readFileFromUserUploads()
        • removeFileFromUserUploads()
        • assignRoleToUser()
        • unassignRoleFromUser()
        • findAllRolesByUser()
        • isUserInAnyRoles()
        • assignRoleToUser()
Powered by GitBook
On this page

Was this helpful?

  1. API References
  2. Backend
  3. utils

initiateEmailVerification()

PreviousverifyHash()NextsaveFileToUserUploads()

Last updated 1 year ago

Was this helpful?

This function is crucial for sending OTP verification emails, enhancing user security by delivering dynamic and time-sensitive authentication codes. Its versatility extends to diverse applications, ensuring a reliable and secure means of user identity confirmation.

Here's an example:

import { createBackendFunction, utils } from "@magicjs.dev/backend";

export default createBackendFunction(async function () {
    await utils.initiateEmailVerification("user@gmail.com", 1102); // recipient email, OTP
    return "OTP Sent!";
});

The proper functioning of initiateEmailVerification() necessitates an active subscription with .

Without a valid subscription, the functionality may not perform as intended. Ensure that you have the requisite subscription in place to enable seamless email verification initiation.

mern.ai
Click here to refer GitHub.