-
Notifications
You must be signed in to change notification settings - Fork 0
/
send-mail.py
41 lines (31 loc) · 908 Bytes
/
send-mail.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
#!/usr/bin/python
import smtplib
########
# Config
########
sender_name = "Fake John Doe"
sender_email = '[email protected]'
receiver_name = "Pentest Cyblex"
receiver_email = '[email protected]'
smtp_ip = '1.2.3.4'
subject = "Impersonated email"
message = "This is an impersonated email"
###################
# Do not edit below
###################
data = "From: " + sender_name + " <" + sender_email + ">\n"
data += "To: " + receiver_name + " <" + receiver_email + ">\n"
data += "Subject: " + subject + "\n"
data += "\n"
data += message
data += "\n"
print("The message below will be sent:")
print("---------------------------------")
print(data)
print("---------------------------------")
try:
smtpObj = smtplib.SMTP(smtp_ip)
smtpObj.sendmail(sender_email, [receiver_email], data)
print("Successfully sent email")
except SMTPException:
print("Error: unable to send email")