Skip to content

Instantly share code, notes, and snippets.

@DustinAlandzes
Created January 25, 2017 22:04
Show Gist options
  • Save DustinAlandzes/60b6e0c6423bb49d700f27ee3f5fcc90 to your computer and use it in GitHub Desktop.
Save DustinAlandzes/60b6e0c6423bb49d700f27ee3f5fcc90 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import smtplib
login = {"username":"", "password":""}
mailgun = {"server": "smtp.mailgun.org", "port": 587}
def send_message_via_smtp(sender, reciever, msg):
smtp = smtplib.SMTP(mailgun["server"], mailgun["port"])
smtp.login(login["username"], login["password"])
smtp.sendmail(sender, reciever, msg)
if __name__ == "__main__":
import sys
input = ""
for line in sys.stdin:
input += line
print("Message:")
print(input)
send_message_via_smtp("pibot@n-compass.biz", "dustin@n-compass.biz", input)
send_message_via_smtp("pibot@n-compass.biz", "john@n-compass.biz", input)
print("Sent to Dustin & John")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment