<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python email question in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-email-question/m-p/45234#M3566</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to send a email using the smtplib package and am getting the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;import smtplib&lt;/LI&gt;&lt;LI&gt;server_ssl = smtplib.SMTP_SSL('smtp.office365.com', xxx)&lt;/LI&gt;&lt;LI&gt;server_ssl.ehlo() # optional, called by login()&lt;/LI&gt;&lt;LI&gt;server_ssl.login('xxxx@xxx.local', 'xx')&lt;/LI&gt;&lt;LI&gt;# ssl server doesn't support or need tls, so don't call server_ssl.starttls()&lt;/LI&gt;&lt;LI&gt;server_ssl.sendmail("xxx@xxx.com", "xxx@xxx.com", "hello")&lt;/LI&gt;&lt;LI&gt;#server_ssl.quit()&lt;/LI&gt;&lt;LI&gt;server_ssl.close()&lt;/LI&gt;&lt;LI&gt;print 'successfully sent the mail'&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "Script5.py", line 3, in &amp;lt;module&amp;gt;&lt;BR /&gt; server_ssl = smtplib.SMTP_SSL('smtp.office365.com', xxx)&lt;BR /&gt; File "C:\Python27\ArcGIS10.7\lib\smtplib.py", line 802, in __init__&lt;BR /&gt; SMTP.__init__(self, host, port, local_hostname, timeout)&lt;BR /&gt; File "C:\Python27\ArcGIS10.7\lib\smtplib.py", line 259, in __init__&lt;BR /&gt; raise SMTPConnectError(code, msg)&lt;BR /&gt;smtplib.SMTPConnectError: (-1, 'The Microsoft Exchange IMAP4 service is ready. [QgBOADYAUABSADEAMQBDAEEAMAAw]')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is appreciated. Thank you!&amp;nbsp;#&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Aug 2019 20:58:22 GMT</pubDate>
    <dc:creator>MarcoPretorius1</dc:creator>
    <dc:date>2019-08-05T20:58:22Z</dc:date>
    <item>
      <title>Python email question</title>
      <link>https://community.esri.com/t5/python-questions/python-email-question/m-p/45234#M3566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to send a email using the smtplib package and am getting the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;import smtplib&lt;/LI&gt;&lt;LI&gt;server_ssl = smtplib.SMTP_SSL('smtp.office365.com', xxx)&lt;/LI&gt;&lt;LI&gt;server_ssl.ehlo() # optional, called by login()&lt;/LI&gt;&lt;LI&gt;server_ssl.login('xxxx@xxx.local', 'xx')&lt;/LI&gt;&lt;LI&gt;# ssl server doesn't support or need tls, so don't call server_ssl.starttls()&lt;/LI&gt;&lt;LI&gt;server_ssl.sendmail("xxx@xxx.com", "xxx@xxx.com", "hello")&lt;/LI&gt;&lt;LI&gt;#server_ssl.quit()&lt;/LI&gt;&lt;LI&gt;server_ssl.close()&lt;/LI&gt;&lt;LI&gt;print 'successfully sent the mail'&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; File "Script5.py", line 3, in &amp;lt;module&amp;gt;&lt;BR /&gt; server_ssl = smtplib.SMTP_SSL('smtp.office365.com', xxx)&lt;BR /&gt; File "C:\Python27\ArcGIS10.7\lib\smtplib.py", line 802, in __init__&lt;BR /&gt; SMTP.__init__(self, host, port, local_hostname, timeout)&lt;BR /&gt; File "C:\Python27\ArcGIS10.7\lib\smtplib.py", line 259, in __init__&lt;BR /&gt; raise SMTPConnectError(code, msg)&lt;BR /&gt;smtplib.SMTPConnectError: (-1, 'The Microsoft Exchange IMAP4 service is ready. [QgBOADYAUABSADEAMQBDAEEAMAAw]')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is appreciated. Thank you!&amp;nbsp;#&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2019 20:58:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-email-question/m-p/45234#M3566</guid>
      <dc:creator>MarcoPretorius1</dc:creator>
      <dc:date>2019-08-05T20:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Python email question</title>
      <link>https://community.esri.com/t5/python-questions/python-email-question/m-p/45235#M3567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer the following sample code which might be helpful for you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#system Modules&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import httplib&lt;/P&gt;&lt;P&gt;import smtplib&lt;/P&gt;&lt;P&gt;from email.MIMEText import MIMEText&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;host = "xxxxx-xxxx.xxx"&lt;/P&gt;&lt;P&gt;fromAdd = "fromemailaddress_Admin"&lt;/P&gt;&lt;P&gt;toAdd = "Your email address"&lt;/P&gt;&lt;P&gt;msg = MIMEText(stringInput)&lt;/P&gt;&lt;P&gt;msg['Subject'] = "Subject"&lt;/P&gt;&lt;P&gt;msg['From'] = fromAdd&lt;/P&gt;&lt;P&gt;msg['To'] = toAdd&lt;/P&gt;&lt;P&gt;s = smtplib.SMTP()&lt;/P&gt;&lt;P&gt;s.connect(host)&lt;/P&gt;&lt;P&gt;s.sendmail(fromAdd, msg["To"].split(","), msg.as_string())&lt;/P&gt;&lt;P&gt;s.close()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Aug 2019 06:48:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-email-question/m-p/45235#M3567</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-08-06T06:48:07Z</dc:date>
    </item>
  </channel>
</rss>

