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 os | |
def send_email(host, port, username, password, subject, body, mail_to, mail_from = None, reply_to = None): | |
if mail_from is None: mail_from = username | |
if reply_to is None: reply_to = mail_to | |
message = """From: %s\nTo: %s\nReply-To: %s\nSubject: %s\n\n%s""" % (mail_from, mail_to, reply_to, subject, body) | |
print (message) | |
try: |