Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Last active August 24, 2020 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/acbc3b242a56637c16f5c94e4b89cb40 to your computer and use it in GitHub Desktop.
Save amankharwal/acbc3b242a56637c16f5c94e4b89cb40 to your computer and use it in GitHub Desktop.
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