1.0.2 • Published 3 years ago
otp-mailer-verifier v1.0.2
Features
- Easy to use.
- Less lines of code.
- Generates , sends(email) and verifies otp.
Prerequisites
Inorder to send email , you will be requiring a password which is easy to generate. Following are the steps to generate this password: 0. Your account should have 2 step authentication. 1. Go to your Google account. (Use the account from which you have to send email). 2. Go to security. 3. Under security, there is an option called "app passwords". 4. In app password, generate a password and copy it.
Here is a video on how to generate app password. You can refer to this.
Installation
npm install otp-mailer-verifier
Usage
- Require the package.
const otpMailer = require('otp-mailer-verifier');
With this package, you can easily generate 6 digit otp, send otp on mails and verifies otp entered by user.
- Generating and sending a otp on email.
otpMailer.send(senderMail,password,receiverMail);
// here password is the app password that is generated using Google account.
//here all the parameters should be of string datatype.
For eg:
otpMailer.send("siddhibhanushali@gmail.com","aadfffgghh","mrudulkolambe@gmail.com");
- Verifying the otp.
otpMailer.verify(userEnteredOtp);
// here userEnteredOtp is the otp which can be taken as input from the user
For eg:
otpMailer.verify(123456);