Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions python/reissue_book/Library_college.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
import json
import os
import sys
from mailer import send


#reading and saving user's information for authentication
def user_auth():
username=input('Enter username(reg. no.):-')
password=getpass.getpass('Enter password:-')
email=input('Enter your email address:-')
emailpass=getpass.getpass('Enter email password:-')
data={'username':username,
'password':password}
'password':password,
'email':email,
'emailpass':emailpass}
with open('data.json','w') as outfile:
json.dump(data,outfile)

Expand Down Expand Up @@ -105,6 +110,8 @@ def user_auth():
else:
print('RETURN NEEDED !!!')
print('You need to return ""'+book[i].text+'"" today. ')
#function to send self-reminder in user's email
send()

#closing browser/webdriver
browser.close()
Expand Down
Binary file not shown.
17 changes: 17 additions & 0 deletions python/reissue_book/mailer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def send():
import smtplib

smtp = smtplib.SMTP('smtp.gmail.com',587)

smtp.starttls() #starting transport layer security

with open('data.json') as json_file:
data = json.load(json_file)

smtp.login(data['email'],data['emailpass'])

message = "Self reminding for library book reissue"

smtp.sendmail(data['email'],data['email'], message)

smtp.quit()