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 = "nms1.cityofnapa.org"
FROM = "johndoe@cityofnapa.org"
TO = "johndoe@cityofnapa.org"
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)
server.quit()
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
SERVER = "cityofnapa-org.mail.protection.outlook.com"
But now the error emails never get sent out.
Any ideas?
Any help is appreciated.
KW