OTP Verification using Python

 Steps to Create an OTP Verification System using Python:-

  1. 1.First, create a 6-digit random number. 

  2. 2.Then store the number in a variable. 

  3. 3.Then we need to write a program to send emails. 

  4. 4.When sending email, we need to use OTP as a message. 

  5. 5.Finally, we need to request two user inputs; first for the user’s email and then for the OTP that the user has received.

Source Code:-

import os import math
import random
import smtplib
digits="0123456789"
OTP=""
for i in range(6):
OTP+=digits[math.floor(random.random()*10)]
otp = OTP + " is your OTP"
msg= otp
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login("Your Gmail Account", "You app password")
emailid = input("Enter your email: ")
s.sendmail('&&&&&&&&&&&',emailid,msg)
a = input("Enter Your OTP >>: ")
if a == OTP:
print("Verified")
else:
print("Please Check your OTP again")

Comments

Popular posts from this blog

Draw Virat Kohli's Cartoon face using python turtle graphics

Wish Happy Friendship Day using Python turtle graphics

Rainbow benzene using Python turtle Graphics