Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/otp verification Secret

Last active Aug 24, 2020
Embed
What would you like to do?
import os,math
import random,sys
import smtplib
mailid=sys.argv[1]
digits="0123456789"
OTP=""
for i in range(6):
OTP+=digits[math.floor(random.random()*10)]
msg='Your OTP Verification for app is '+OTP+' Note.. Please enter otp within 2 minutes and 3 attempts, otherwise it becomes invalid'
file2=open("otp.txt","w")
file2.write(OTP)
file2.close()
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login("your email id", "your app password")
print(msg)
s.sendmail('your email id',mailid,msg)
os.system('python second.py')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment