Skip to content

Commit 3d94ff6

Browse files
committed
We did some debugging and fixed code that was causing errors
1 parent a966a68 commit 3d94ff6

1 file changed

Lines changed: 16 additions & 23 deletions

File tree

main.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
import smtplib
2-
try:
3-
from lists import (names,emails)
4-
except:
5-
ListsFileOpen = open("lists.py", "w")
6-
ListsFileOpen.write("names = []\nemails = []")
7-
print("Debug Info: Created lists.py file to dump names and emails\n")
8-
ListsFileOpen.close()
9-
from lists import (names,emails)
2+
ThatFile = open("lists.py", "a")
3+
ThatFile.close()
4+
from lists import *
105
from email.mime.multipart import MIMEMultipart
116
from email.mime.text import MIMEText
127

13-
listToWrite = ["hi","this","is","a","test"]
14-
158
s = smtplib.SMTP('smtp.gmail.com', 587)
169

1710
username = ""
@@ -23,12 +16,20 @@
2316
l = "smtp.gmail.com"
2417
s = smtplib.SMTP(l, 587)
2518
listLen = 0
26-
login = 0
19+
login = 0
20+
21+
try:
22+
if names[0] == names[0]:
23+
names = names
24+
emails = emails
25+
except:
26+
names = []
27+
emails = []
2728

2829
class email:
2930
def save():
30-
print("Debug Info: Names:"+names)
31-
print("Debug Info: Emails:"+emails)
31+
print("Debug Info: Names:"+str(names))
32+
print("Debug Info: Emails:"+str(emails))
3233
theLists = open("lists.py", "w")
3334
stringToSave = 'names = ['
3435
for i in range(len(names)-1):
@@ -53,8 +54,8 @@ def loginSMTP():
5354
login = 0
5455
try:
5556
s.login(str(theirUsername), str(password))
56-
print("Debug Info: Succesful you are now logged in and can send emails\n\n")
5757
login = 1
58+
print("Debug Info: Succesful you are now logged in and can send emails\n\n")
5859
except:
5960
print("Debug Info: Login Failed \nTry changing you allow less secure app access in your gmail account settings, Or reenter your credentials\n\n")
6061
login = 0
@@ -107,13 +108,7 @@ def sendEmail():
107108
print("\n\nSent, "+text)
108109
msg = ""
109110
def choose():
110-
inputString = ("What do you want to do:\n\nAdd An Email from you sending list(A)\nRemove an email from you sending list(R)\n")
111-
if (login == 1):
112-
inputString = inputString+"Send an Email(S)\n"
113-
else:
114-
inputString = inputString+"Login(L)\n"
115-
116-
loginWorked = 1
111+
inputString = "What do you want to do:\n\nAdd An Email from you sending list(A)\nRemove an email from you sending list(R)\nSend an Email(S)\nLogin or change accounts(L)\n"
117112
choice = input(inputString)
118113

119114
if choice.lower() == "a":
@@ -132,8 +127,6 @@ def choose():
132127
print("Debug Info: Session Finished, all personal information deleting...")
133128
theirUsername = ""
134129
password = ""
135-
print(".\n")
136-
print(".\n")
137130
print("All personal information has been deleted")
138131

139132
email.loginSMTP()

0 commit comments

Comments
 (0)