Created
December 31, 2017 13:04
-
-
Save samduy/2b15ef5746099b2447e90bdaf75a9e3b to your computer and use it in GitHub Desktop.
Python Email Sender (sendmail must be installed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import smtplib, string | |
import os, time | |
os.system("/etc/init.d/sendmail start") | |
time.sleep(4) | |
HOST = "localhost" | |
SUBJECT = "Email from spoofed sender" | |
TO = "[email protected]" | |
FROM = "[email protected]" | |
TEXT = "Message Body" | |
BODY = string.join(( | |
"From: %s" % FROM, | |
"To: %s" % TO, | |
"Subject: %s" % SUBJECT, | |
"", | |
TEXT | |
), "\r\n") | |
server = smtplib.SMTP(HOST) | |
server.sendmail(FROM, [TO], BODY) | |
server.quit() | |
time.sleep(4) | |
os.system("/etc/init.d/sendmail stop") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment