I am trying to send a email using the smtplib package and am getting the following error:
Script:
- import smtplib
- server_ssl = smtplib.SMTP_SSL('smtp.office365.com', xyz)
- server_ssl.ehlo() # optional, called by login()
- server_ssl.login('xyz@xyz.local', 'xyz')
- # ssl server doesn't support or need tls, so don't call server_ssl.starttls()
- server_ssl.sendmail("xyz@xyz.com", "xyz@xyz.com", "hello")
- #server_ssl.quit()
- server_ssl.close()
- 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', xyz)
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! #