Last active
January 22, 2018 09:03
-
-
Save aewallin/2a0eb2590c8fe1ad74e5b7ccc2554d03 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
# send email, from e.g. cron-jobs and similar | |
import smtplib | |
from email.mime.text import MIMEText | |
def send_email(me, you, smtp_server, subject, text): | |
msg = MIMEText(text) | |
msg['Subject'] = subject | |
msg['From'] = me | |
msg['To'] = you | |
s = smtplib.SMTP(smtp_server) | |
s.sendmail(me, [you], msg.as_string()) | |
s.quit() | |
if __name__ == "__main__": | |
text = "The message." | |
you = "you@work.com" | |
me = "me@home.com" | |
smtp_server = "my.smtp.server.com" | |
subject =" the subject " | |
send_email(me, you, smtp_server, subject, text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment