-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7c433c
commit c64dadb
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import smtplib, random, string | ||
from email.mime.text import MIMEText | ||
from email.mime.multipart import MIMEMultipart | ||
|
||
toaddrs = input("Enter your email ID: ") | ||
username = '[email protected]' | ||
password = 'passwordnahihai' | ||
x = ''.join(random.choices(string.ascii_letters + string.digits, k=12)) | ||
|
||
message = MIMEMultipart("alternative") | ||
message["Subject"] = "Forgot Password | MedFixture" | ||
message["From"] = username | ||
message["To"] = toaddrs | ||
|
||
html = """\ | ||
<html> | ||
<body> | ||
<h1 align="center">Hi! Seems like you forgot you password. </h1> | ||
<p align="center">Don't worry! Just enter the verification code | ||
given below.</p> | ||
<p align="center">Your verification code is <code>"""+ x +"""</code></p> | ||
</body> | ||
<footer align="center">Project maintained by | ||
<a href="https://github.com/chauhannaman98">chauhannaman98</a></footer> | ||
</html> | ||
""" | ||
|
||
part1 = MIMEText(html, "html") | ||
message.attach(part1) | ||
|
||
|
||
try: | ||
server = smtplib.SMTP('smtp.gmail.com:587') | ||
server.ehlo() | ||
server.starttls() | ||
server.login(username,password) | ||
server.sendmail(username, toaddrs, message.as_string()) | ||
except Exception as e: | ||
print(e) | ||
finally: | ||
server.quit() | ||
|
||
in_code = input("Enter the verification code: ") | ||
if in_code == x: | ||
print("Verification successful") | ||
else: | ||
print("Enter correct verification code") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<body> | ||
<h1 align="center">Hi! Seems like you forgot you password. </h1> | ||
<p align="center">Don't worry! Just enter the verification code | ||
given below.</p> | ||
<p align="center">Your verification code is <code>"""+ x +"""</code></p> | ||
</body> | ||
<footer align="center">Project maintained by | ||
<a href="https://github.com/chauhannaman98">chauhannaman98</a></footer> | ||
</html> |