Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
BIN
+8.88 KB
EmailSender/Subscribers.xlsx
Binary file not shown.
BIN
+696 Bytes
EmailSender/__pycache__/add_email.cpython-38.pyc
Binary file not shown.
BIN
+1.03 KB
EmailSender/__pycache__/quick_guide.cpython-38.pyc
Binary file not shown.
BIN
+958 Bytes
EmailSender/__pycache__/send_email.cpython-38.pyc
Binary file not shown.
BIN
+1.29 KB
EmailSender/__pycache__/spammer.cpython-38.pyc
Binary file not shown.
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,20 @@ | ||
import openpyxl | ||
|
||
|
||
def addSubscriber(): | ||
filename = "Subscribers.xlsx" | ||
openFile = openpyxl.load_workbook("Subscribers.xlsx") | ||
openSheet = openFile.active # gets the active sheet | ||
initialRow = 2 | ||
emailAddress = input(str("What's the email address you would like to add?\nNew subscriber: ")) | ||
|
||
while openSheet.cell(row=initialRow, column=1).value is not None: # look for recipients on the excel sheet | ||
if initialRow == 997: # statement to avoid reaching max depth | ||
print("The maximum of recipients was exceeded! ") | ||
break | ||
else: | ||
initialRow += 1 | ||
|
||
toString = 'A' + str(initialRow) | ||
openSheet[toString] = emailAddress | ||
openFile.save(filename) |
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,46 @@ | ||
from spammer import spammer # imports the function in spammer.py | ||
from send_email import sendEmail # imports the function in send_email.py | ||
from add_email import addSubscriber # imports the function in add_email.py | ||
from quick_guide import quickGuide # imports the function in quick_guide.py | ||
import time # imports time functions | ||
|
||
|
||
def main(): | ||
print("\n== Main Menu ==" | ||
"\n1. Spammer" | ||
"\n2. Send Email" | ||
"\n3. Add subscriber" | ||
"\n4. Quick Guide\n") | ||
choice = str(input("Which option would you like to use?\nOption: ")) | ||
print("\n") | ||
if choice == "1": | ||
spammer() | ||
time.sleep(2) | ||
print("\n") | ||
main() | ||
if choice == "2": | ||
sendEmail() | ||
time.sleep(2) | ||
print("\n") | ||
main() | ||
if choice == "3": | ||
addSubscriber() | ||
time.sleep(2) | ||
print("\n") | ||
main() | ||
if choice == "4": | ||
quickGuide() | ||
time.sleep(2) | ||
print("\n") | ||
main() | ||
else: | ||
print("Invalid choice.\nPlease try again!") | ||
time.sleep(2) | ||
main() | ||
|
||
return choice | ||
|
||
|
||
if __name__ == '__main__': | ||
mainMenu = main() | ||
print(mainMenu) |
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,9 @@ | ||
def quickGuide(): | ||
print("Hello dear user, this is a quick guide on how to use the beta version of my email subscription/ spammer " | ||
"bot.\nHere are the steps you will have to go through in order to work with my bot:\n\n->SETUP:\n1.Create " | ||
"an Excel file named Subscribers.xlsx on the folder you saved the bot;\n2.Add up to 995 email addresses from " | ||
"the cell A1 and below;\n3.Make sure you don't leave any blank cell in between email addresses or else it " | ||
"won't be read.\n\n->OPTIONS:\n1.Spammer - Allows you to spam the email addresses on your excel sheet for " | ||
"an amount of times of your own choice;\n2.Send email - Allows you to send an email with a subject and a " | ||
"body to the emails on your Excel sheet;\n3.Add Subscriber - Type in the email address you wish to add to " | ||
"the Excel spreadsheet.\n\nHope you enjoy it and make a good use of it!") |
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,30 @@ | ||
import openpyxl # import library to read excel files | ||
import smtplib # library to login to gmail, send emails, etc... | ||
|
||
|
||
def sendEmail(): | ||
sender = " " # email address for sender | ||
password = " " # password for sender | ||
openFile = openpyxl.load_workbook("Subscribers.xlsx") | ||
openSheet = openFile.active # gets the active sheet | ||
recipientsList = [] | ||
initialRow = 2 | ||
recipient = openSheet.cell(row=initialRow, column=1).value | ||
|
||
while openSheet.cell(row=initialRow, column=1).value is not None: # look for recipients on the excel sheet | ||
if initialRow == 997: # statement to avoid reaching max depth | ||
print("The maximum of recipients was exceeded! ") | ||
break | ||
else: | ||
initialRow += 1 | ||
recipientsList.append(recipient) | ||
|
||
subject = str(input("What is the subject of the email?\nSubject: ")) | ||
message = str(input("What is the body of your message?\nBody: ")) | ||
|
||
smtp_sever = smtplib.SMTP_SSL("smtp.gmail.com", 465) # sets the server and the port | ||
smtp_sever.login(sender, password) # login to account with email and pw | ||
content = "Subject: {}\n\n{}".format(subject, message) # formats the email | ||
smtp_sever.sendmail(sender, recipient, content) # send message | ||
|
||
smtp_sever.close() # closes server/ disconnects |
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,45 @@ | ||
import openpyxl # import library to read excel files | ||
import smtplib # library to login to gmail, send emails, etc... | ||
import time # imports time functions | ||
|
||
|
||
def spammer(): | ||
sender = " " # email address for sender | ||
password = " " # password for sender | ||
openFile = openpyxl.load_workbook("Subscribers.xlsx") | ||
openSheet = openFile.active # gets the active sheet | ||
recipientsList = [] | ||
initialRow = 2 | ||
|
||
while openSheet.cell(row=initialRow, column=1).value is not None: | ||
recipient = openSheet.cell(row=initialRow, column=1).value | ||
if recipient is None: | ||
print("No more emails addresses were found.\nPlease ensure that there's no blank cell in between email " | ||
"addresses!") | ||
break | ||
elif initialRow == 997: | ||
print("The maximum of recipients was exceeded! ") | ||
break | ||
else: | ||
initialRow += 1 | ||
recipientsList.append(recipient) | ||
|
||
subject = str(input("What is the subject of the email?\nSubject: ")) | ||
message = str(input("What is the body of your message?\nBody: ")) | ||
numberOfEmails = int(input("How many times do you want to spam this email?\n== Be aware the limit is 100 == " | ||
"\nSpam number: ")) | ||
|
||
smtp_sever = smtplib.SMTP_SSL("smtp.gmail.com", 465) | ||
smtp_sever.login(sender, password) | ||
content = "Subject: {}\n\n{}".format(subject, message) | ||
|
||
if numberOfEmails > 995: | ||
numberOfEmails = 995 | ||
|
||
while numberOfEmails > 0: | ||
numberOfEmails -= 1 | ||
for recipient in recipientsList: | ||
time.sleep(5) # avoids server disconnection from gmail | ||
smtp_sever.sendmail(sender, recipient, content) | ||
|
||
smtp_sever.close() |