Skip to content

Commit 74cd41c

Browse files
authored
Merge pull request powerexploit#25 from noobdev59/master
Send mail using SMTP
2 parents 9976472 + e1bf62f commit 74cd41c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Scripts/send_mail.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# need to import the smtp lib
2+
import smptplib
3+
4+
5+
# TLS port = 587, normal_port=465
6+
smtp_obj = smtplib.SMTP('smtp.gmail.com', 587)
7+
print("TYPE_SMTP_OBJ", type(smtp_obj))
8+
9+
smtp_obj.ehlo()
10+
11+
#starttls() puts smtp in TLS mode
12+
smtp_obj.starttls()
13+
14+
smtp_obj.login('email_address', 'password')
15+
16+
sender_email_adress = 'abcd@efg.com'
17+
list_of_reciever_addresses = ['email_1@xxxx.com', 'email_2@xxxx.com']
18+
19+
smtp_obj.sendemail(sender_email_address, list_of_reciever_addresses, 'Subject: the body of the message')
20+
21+
#close the smtp obj when done
22+
smtp_obj.quit()

0 commit comments

Comments
 (0)