You can do it this way.
sendEmailVerification = async () => {
let user = Moralis.User.current(); // delete this if setted globaly
let userEmail = user.attributes.email;
await Moralis.User.requestEmailVerification(email)
.then(() => {
//user will get an email with a link. If the user clicks on the link his user get authenticated.
console.log("Successfully sent email verification email");
})
.catch((error) => {
// Show the error message somewhere
alert("Error: " + error.code + " " + error.message);
});
};
Also, check out the docs over here for more email authentication states. –
https://docs.moralis.io/moralis-server/users/email-login#verifying-emails
Hope this helps.
Happy BUIDLing!