Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created April 13, 2021 19:03
Show Gist options
  • Save amankharwal/de08420bac3e428c23342ddeca500d6b to your computer and use it in GitHub Desktop.
Save amankharwal/de08420bac3e428c23342ddeca500d6b to your computer and use it in GitHub Desktop.
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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment