-
Notifications
You must be signed in to change notification settings - Fork 6
/
smtp-bulk.py
158 lines (117 loc) · 5.74 KB
/
smtp-bulk.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
from email import message
import smtplib, ssl
from time import strftime
import time
from random import *
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.message import EmailMessage
from email.headerregistry import Address
from email.header import Header
import smtplib
import colorama
from colorama import Fore
from colorama import *
from datetime import datetime
from datetime import date
import os
import platform
platform.system()
if platform.system() == 'Linux':
clear = lambda: os.system('clear')
else:
clear = lambda: os.system('cls')
#Took me 2 hours to get this shit done so unless u are adding some stuff dont fucking touch a shit
today = date.today()
print(Fore.RED + f"""
SMTP Bulk Sender v 1.0.0 Coded By :
mrhouse998
Date : {today}
Contact : https://t.me/itslucifero """)
try:
context = ssl.create_default_context()
#variables tawa3na :
print(f'\n[+]SETUP SMTP SERVER FIRST : ')
smtp_server = input('Enter your smtp server HOST: ')
smtp_port = input('Enter your SMTP port :')
smtp_user = input('Please enter your SMTP USERNAME : ')
smtp_pass = input('Enter your SMTP password : ')
clear()
print(Fore.RED +f"""
SMTP Bulk Sender v 1.0.0 Coded By :
mrhouse998
Date : {today}
Contact : https://t.me/mrhouse998 """)
print(f'\n NOW THE LETTER PARTS : ')
letter_subject = input(' Subject of letter : ')
letter_path = input('Please Enter PATH TO letter HTML.txt : ')
letter_From = input('Enter Letter FROM Name ( EX: Support ) : ')
except KeyboardInterrupt:
print("\nCTRL+C Detect, leaving :D")
exit()
#Fuction lewla njibou les emails men txt
def get_contacts(filename):
emails = []
with open(filename, mode='r', encoding='utf-8') as contacts_file:
for a_contact in contacts_file:
emails.append(a_contact.split()[0])
return emails
mails = get_contacts(input('Enter Path To Mail List (PLEASE FILTER YOUR MAIL LIST) : '))
clear()
print(Fore.GREEN + f"""
SMTP Bulk Sender v 1.0.0 Coded By :
mrhouse998
Date : {today}
Contact : https://t.me/mrhouse998 \n """)
print(Fore.GREEN +'''##########################SENDING DONT PANIC###############################''')
#2eme function de send
def generate_messages(recipients):
with open(letter_path, 'r') as myfile:
data = myfile.read()
for recipient in recipients:
message = EmailMessage()
message['Subject'] = letter_subject
message['From'] = Address(letter_From, *smtp_user.split("@"))
message['To'] = recipient
message.set_content(data, 'html')
yield message
def smtp(smtp_server, port, user, password, messages):
try:
if port == '587':
with smtplib.SMTP(smtp_server, port) as server:
try:
server.login(user, password)
print(Fore.GREEN +
f'''\n\n\nSMTP CONNECTION ESTABLISHED :\n SERVER : {smtp_server}\n User: {user}\n Pass: {password}\n PORT : {port} \n NO CONNECTION ERRORS! \n Wish with me no other erors haha ''')
for message in messages:
now = datetime.now()
time.sleep(5)
server.send_message(message)
print(Fore.GREEN +'\n[+]', message['To'] + f''' SENT! {time.strftime('%X')}''')
print(Fore.GREEN +'''\n ###################################################################### SENT''')
except smtplib.SMTPException:
print(Fore.RED +'SMTP DIED OR DEAD [-] Error: unable to send email')
elif port == '465':
with smtplib.SMTP_SSL(smtp_server, port) as server:
try:
server.login(user, password)
print(f'''\n\n\nSMTP CONNECTION ESTABLISHED :\n SERVER : {smtp_server}\n User: {user}\n Pass: {password}\n PORT : {port} \n NO CONNECTION ERRORS! \n Wish with me no other erors haha ''')
for message in messages:
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
time.sleep(5)
server.send_message(message)
print(Fore.GREEN +'\n[+]', message['To'] + f''' SENT! {time.strftime('%X')}''')
print(Fore.GREEN +'''\n ###################################################################### SENT''')
except smtplib.SMTPException:
print(Fore.RED +'SMTP DIED OR DEAD [-] Error: unable to send email')
else:
print('wrong PORT')
except KeyboardInterrupt:
print("CTRL+C Detect, leaving :D")
exit()
try:
smtp(smtp_server=smtp_server, port=smtp_port, user=smtp_user, password=smtp_pass, messages=generate_messages(mails))
except KeyboardInterrupt:
print('\nCTRL + C DETECTED LEAVING')
exit()