AnsweredAssumed Answered

Python email question

Question asked by mpretorius on Aug 5, 2019
Latest reply on Aug 5, 2019 by rdhulipudiesriaustralia-com-au-esridist

I am trying to send a email using the smtplib package and am getting the following error:

 

Script:

 

  1. import smtplib
  2. server_ssl = smtplib.SMTP_SSL('smtp.office365.com', xxx)
  3. server_ssl.ehlo() # optional, called by login()
  4. server_ssl.login('xxxx@xxx.local', 'xx')
  5. # ssl server doesn't support or need tls, so don't call server_ssl.starttls()
  6. server_ssl.sendmail("xxx@xxx.com", "xxx@xxx.com", "hello")
  7. #server_ssl.quit()
  8. server_ssl.close()
  9. print 'successfully sent the mail'

 

Error: 

 

Traceback (most recent call last):
File "Script5.py", line 3, in <module>
server_ssl = smtplib.SMTP_SSL('smtp.office365.com', xxx)
File "C:\Python27\ArcGIS10.7\lib\smtplib.py", line 802, in __init__
SMTP.__init__(self, host, port, local_hostname, timeout)
File "C:\Python27\ArcGIS10.7\lib\smtplib.py", line 259, in __init__
raise SMTPConnectError(code, msg)
smtplib.SMTPConnectError: (-1, 'The Microsoft Exchange IMAP4 service is ready. [QgBOADYAUABSADEAMQBDAEEAMAAw]')

 

Any help is appreciated. Thank you! #

Outcomes