Skip to content

Instantly share code, notes, and snippets.

@galehrizky
Last active March 14, 2022 18:31
Show Gist options
  • Save galehrizky/4a7bfd313181afbd32235d155891fa37 to your computer and use it in GitHub Desktop.
Save galehrizky/4a7bfd313181afbd32235d155891fa37 to your computer and use it in GitHub Desktop.
Mass smtp checker with letter
# Coded by galehdotid
# if u change this copyright u n00b <3
# contact : galehrizky123@gmail.com
# format list : host|port|username|password
# requirement : python3
# use : python3 mass_smtp.py
import smtplib,sys,socket,random,os
from random import randrange
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from concurrent.futures import ThreadPoolExecutor
def read_letter(filename):
try:
with open(filename, 'r', encoding='utf-8') as letter_cok:
templete_letter = letter_cok.read()
return templete_letter
except IOError as e:
print("File not found !")
sys.exit()
pass
def save(bjir, names):
s = open(names, "a+")
s.write(bjir+"\n")
def smtpTest(host_,port_,username_,password_,letter_,email_,save_):
try:
s = smtplib.SMTP(host=host_, port=port_)
s.ehlo()
s.starttls()
s.login(username_,password_)
msg = MIMEMultipart()
msg['From'] = username_
msg['To'] = email_
msg['Subject'] = 'Just Test ! #{}'.format(randrange(100))
msg['X-Priority'] = '1'
msg.attach(MIMEText(letter_,'html'))
s.send_message(msg)
del msg
s.quit()
bjirrgans= host_+"|"+port_+"|"+username_+"|"+password_
save(bjirrgans,save_)
print("[+] Success Test send to {} with smtp -> {}".format(email_, host_))
except socket.error as e:
print("[-] SMTP NOT CONNECTED ! -> {}".format(username_))
pass
except smtplib.SMTPException as error:
print(error)
print("[-] Unable to send smtp ! -> {}".format(username_))
pass
def main():
try:
# templete SMTP
templete = input("Put your templete -> ")
# List SMTP
smtp_list = input("Put your smtp list -> ")
#threads
trit = int(input("Put Your Thread Number -> "))
#set email list
email = input("Put Your Email List -> ")
# save as
save = input("Save as -> ")
#clear terminal
os.system('cls' if os.name == 'nt' else 'clear')
letter = read_letter(templete)
try:
with ThreadPoolExecutor(max_workers=trit) as executor:
with open(smtp_list, 'r') as smtp:
for smtper in smtp:
toArray = smtper.rstrip().split('|')
if len(toArray) == 4:
#define smtp
host = toArray[0]
if 'smtp.gmail.com' not in host and 'smtp.googlemail.com' not in host:
port = toArray[1]
username = toArray[2]
password = toArray[3]
#smtp send
with open(email, 'r') as emailss:
for em in emailss:
executor.submit(smtpTest,host,port,username,password,letter,em.rstrip(),save)
else:
print("[-] This SMTP GOOGLE -> {}".format(host))
else:
print("[-] Something Wrong ");
except IOError as e:
print("[-] YOUR SMTP LIST NOT FOUND !")
sys.exit()
pass
except Exception as e:
pass
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt as e:
print("[!] Exit Program....")
sys.exit()
pass
@kingsalman99
Copy link

mantap bang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment