Newer
Older
TestStandRepository / Software / Tools / SendEmail.py
@Federica Lionetto Federica Lionetto on 13 Apr 2015 471 bytes Add feature to send email at the end of the measurements
import smtplib
from email.mime.text import MIMEText as text

def send_email(sender,receiver,message,subject) :
    sender = sender
    receiver = receiver
    m = text(message)
    m['Subject'] = subject
    m['From'] = sender
    m['To'] = receiver

    try :
        smtpObj = smtplib.SMTP('localhost')
        smtpObj.sendmail(sender, receiver, str(m))
        print "Successfully sent email."
    except SMTPException :
        print "Error! Unable to send email..."