AnsweredAssumed Answered

Python outlook smtp server connection

Question asked by awhitley67 on Sep 4, 2018
Latest reply on Sep 4, 2018 by rvburton

I have been trying to utilize Jake's solution located here… to send an email from outlook when a new feature is added. However, I keep receiving the falling traceback error:


Traceback (most recent call last):
  File "C:\Users\twhitley\Documents\", line 66, in <module>
    smtpObj.sendmail(FROM, TO, message)
  File "C:\Python27\ArcGIS10.3\lib\", line 723, in sendmail
  File "C:\Python27\ArcGIS10.3\lib\", line 462, in rset
    return self.docmd("rset")
  File "C:\Python27\ArcGIS10.3\lib\", line 387, in docmd
    return self.getreply()
  File "C:\Python27\ArcGIS10.3\lib\", line 363, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed

My python parameters for outlook are this:

fromEmail = '' # Email sender
toEmail = ''   # Email receiver
smtpServer = ''    # SMPT Server Name
portNumber = 587                # SMTP Server port

Can someone point me in the right direction; the script Generates the token as expected but seems to hang at the SMTP settings. #