Skip to content

Instantly share code, notes, and snippets.

@DustinAlandzes
Last active May 16, 2017 08:50
Show Gist options
  • Save DustinAlandzes/c38eaf0f186a2681401b05d422aebad2 to your computer and use it in GitHub Desktop.
Save DustinAlandzes/c38eaf0f186a2681401b05d422aebad2 to your computer and use it in GitHub Desktop.
# smtp library that does it all for you!
import smtplib as s
# organic whole range smtp server goes here
smtpServer = ""
# usually 25, 465, 587
smtpPort =
username = ""
password = ""
numOfMessages = 20
message = "hello world"
WhoToSendTo = "[email protected]"
# okay, so connect to the smtp server, specify ip and port
obj = s.SMTP(smtpServer, smtpPort)
# wtf is ehlo
obj.ehlo()
# start tls sure
obj.starttls()
# wtf is ehlo
obj.ehlo()
# ok, login specify username and password
obj.login(username, password)
# i guess this is the structure of the actual message
message = ("From: "+username+"\r\nTo: "+fullAddress+" \r\n\r\n "+message)
# same as `for (x = 0; x < numOfMessages; x++)`
for x in range(numOfMessages):
# cool, we're actually sending the mail
obj.sendmail(username, WhoToSendTo, message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment