AnsweredAssumed Answered

python email message for errors

Question asked by on Feb 3, 2016
Latest reply on Feb 4, 2016 by

For years I had all my python jobs set up to send me an email error message if the python job did not complete successfully.
We just upgraded out outlook to Outlook 365.
My python code always looked like


def reportError( msg ):   

    SERVER = ""

    FROM = ""

    TO = ""

    SUBJECT = socket.gethostname() + " - compress ERROR"

    TEXT = msg


    # Prepare actual message

    message = """\

    From: %s

    To: %s

    Subject: %s %s """ % (FROM, TO , SUBJECT, "Text")

    message = "From: %s\nTo: %s\nSubject: %s\n\n%s" % ( FROM, TO, SUBJECT, TEXT )    

    # Send the mail

    server = smtplib.SMTP(SERVER)

    server.sendmail(FROM, TO, message)


    print msg

    print "error"


My IT department sent out a message saying that the new outlook 365 server is now

So I changed the top line of my code to


But now the error emails never get sent out.
Any ideas? 

Any help is appreciated.