Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
72 lines (59 loc) · 2.16 KB
/
Copy pathmain.py
File metadata and controls
72 lines (59 loc) · 2.16 KB
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
from email.message import EmailMessage
from platform import platform
import time, datetime, colorama
from colorama import Fore, Back , Style
import os
import pyfiglet
from pyfiglet import figlet_format as fgd
import platform
import smtplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from prettytable import PrettyTable
date = datetime.datetime.now()
s = date.strftime('%c')
os.system("cls||clear")
fl = fgd("EMAIL SENDER")
print(fl)
print("\n")
print(Fore.GREEN + "Email Sender" + Style.RESET_ALL)
print("\n")
sender_email = "Your Mail"
receiver_email = input(Fore.RED + "[+] " + Style.RESET_ALL + "Rechiever Email > ")
receiver_email
subject = input(Fore.RED + "[+] " + Style.RESET_ALL + "Subject > ")
message_div = input(Fore.RED + "[+] " + Style.RESET_ALL + "Message > ")
password = "Key App Password"
print("\n")
print("Information Services [ EMAIL STATUS ]")
myTable = PrettyTable(["Author", "Email Sender", "Rechiever", "Message Length", "Timestamp"])
myTable.add_row([platform.node(), sender_email, receiver_email, len(message_div), s])
print(myTable)
message = MIMEMultipart("alternative")
message["Subject"] = subject
message["From"] = "Random Mail"
message["To"] = receiver_email
# Create the plain-text and HTML version of your message
email_html = f"""\
<html>
<body>
<p>{message_div}</p>
</body>
</html>
"""
# Turn these into plain/html MIMEText objects
mailTest = MIMEText(email_html, "html")
# Add HTML/plain-text parts to MIMEMultipart message
# The email client will try to render the last part first
message.attach(mailTest)
# Create secure connection with server and send email
context = ssl.create_default_context()
with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as server:
server.login(sender_email, password)
server.sendmail(
sender_email, receiver_email, message.as_string()
)
os.system("cls||clear")
print("email was sent to " + Fore.BLUE + receiver_email + Style.RESET_ALL + " by " + Fore.RED + sender_email + Style.RESET_ALL)
time.sleep(10)
os.system("cls||clear")