otp-mailer-verifier
v1.0.2
Published
Generates, sends and validates otp on email
Downloads
2
Readme
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.
- Go to your Google account. (Use the account from which you have to send email).
- Go to security.
- Under security, there is an option called "app passwords".
- In app password, generate a password and copy it.
Here is a video on how to generate app password. You can refer to this.
https://user-images.githubusercontent.com/69195262/139570236-4f6330f4-f275-4624-84e4-bb6127668c73.mp4
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("[email protected]","aadfffgghh","[email protected]");
- 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);