Created
March 25, 2016 18:41
-
-
Save APTy/4264ec8126ad0c0925e2 to your computer and use it in GitHub Desktop.
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
import smtplib | |
import email.mime.text as text | |
TARGETS = ['me@example.com',] | |
def notify(targets, subject, message): | |
server = smtplib.SMTP('smtp.gmail.com:587') | |
server.ehlo() | |
server.starttls() | |
server.login('yoursenderemail@gmail.com', 'yourpassword') | |
for target in targets: | |
msg = text.MIMEText(message) | |
msg['Subject'] = subject | |
msg['From'] = 'yoursenderemail@gmail.com' | |
msg['To'] = target | |
server.send_message(msg) | |
server.quit() | |
notify(TARGETS, 'hello', 'hello this is a test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment