You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: main.py
+16-23Lines changed: 16 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,10 @@
1
1
importsmtplib
2
-
try:
3
-
fromlistsimport (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
-
fromlistsimport (names,emails)
2
+
ThatFile=open("lists.py", "a")
3
+
ThatFile.close()
4
+
fromlistsimport*
10
5
fromemail.mime.multipartimportMIMEMultipart
11
6
fromemail.mime.textimportMIMEText
12
7
13
-
listToWrite= ["hi","this","is","a","test"]
14
-
15
8
s=smtplib.SMTP('smtp.gmail.com', 587)
16
9
17
10
username=""
@@ -23,12 +16,20 @@
23
16
l="smtp.gmail.com"
24
17
s=smtplib.SMTP(l, 587)
25
18
listLen=0
26
-
login=0
19
+
login=0
20
+
21
+
try:
22
+
ifnames[0] ==names[0]:
23
+
names=names
24
+
emails=emails
25
+
except:
26
+
names= []
27
+
emails= []
27
28
28
29
classemail:
29
30
defsave():
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))
32
33
theLists=open("lists.py", "w")
33
34
stringToSave='names = ['
34
35
foriinrange(len(names)-1):
@@ -53,8 +54,8 @@ def loginSMTP():
53
54
login=0
54
55
try:
55
56
s.login(str(theirUsername), str(password))
56
-
print("Debug Info: Succesful you are now logged in and can send emails\n\n")
57
57
login=1
58
+
print("Debug Info: Succesful you are now logged in and can send emails\n\n")
58
59
except:
59
60
print("Debug Info: Login Failed \nTry changing you allow less secure app access in your gmail account settings, Or reenter your credentials\n\n")
60
61
login=0
@@ -107,13 +108,7 @@ def sendEmail():
107
108
print("\n\nSent, "+text)
108
109
msg=""
109
110
defchoose():
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"
117
112
choice=input(inputString)
118
113
119
114
ifchoice.lower() =="a":
@@ -132,8 +127,6 @@ def choose():
132
127
print("Debug Info: Session Finished, all personal information deleting...")
133
128
theirUsername=""
134
129
password=""
135
-
print(".\n")
136
-
print(".\n")
137
130
print("All personal information has been deleted")
0 commit comments