<?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 How to display Python results into Email Body. in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641235#M49960</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use from email.mime.text import MIMEText to use typed text into the email body.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I pass the python returned results into the body of an email?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Sep 2019 16:16:47 GMT</pubDate>
    <dc:creator>DevinUnderwood3</dc:creator>
    <dc:date>2019-09-19T16:16:47Z</dc:date>
    <item>
      <title>How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641235#M49960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use from email.mime.text import MIMEText to use typed text into the email body.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I pass the python returned results into the body of an email?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 16:16:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641235#M49960</guid>
      <dc:creator>DevinUnderwood3</dc:creator>
      <dc:date>2019-09-19T16:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641236#M49961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the reference for the python email package which also handles MIME:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.python.org/3.4/library/email.html" title="https://docs.python.org/3.4/library/email.html" rel="nofollow noopener noreferrer" target="_blank"&gt;19.1. email — An email and MIME handling package — Python 3.4.10 documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some examples:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.python.org/3.4/library/email-examples.html" title="https://docs.python.org/3.4/library/email-examples.html" rel="nofollow noopener noreferrer" target="_blank"&gt;19.1.14. email: Examples — Python 3.4.10 documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a working script example that I found on stackoverflow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://stackoverflow.com/questions/38825943/mimemultipart-mimetext-mimebase-and-payloads-for-sending-email-with-file-atta" title="https://stackoverflow.com/questions/38825943/mimemultipart-mimetext-mimebase-and-payloads-for-sending-email-with-file-atta" rel="nofollow noopener noreferrer" target="_blank"&gt;MIMEMultipart, MIMEText, MIMEBase, and payloads for sending email with file attachment in Python - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the code from stackoverflow, you would substitute the text for "body =" with any information from arcpy. For example if you wanted to know the feature count of a feature class or layer and you wanted to email your self the count. You would do something like what is below ( I have no idea if this works, I just quickly hacked it together). You will also need to learn how to use SMTP lib so you can connect, login and send emails. Take the code below and see if you can get it to send an email.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have Fun!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; smtplib
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; email&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MIMEMultipart &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; MIMEMultipart
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; email&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MIMEText &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; MIMEText
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; email&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MIMEBase &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; MIMEBase
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; email &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; encoders

lyrfile &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\data\streets.lyr"&lt;/SPAN&gt;
result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyrfile&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

fromaddr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"YOUR EMAIL"&lt;/SPAN&gt;
toaddr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"EMAIL ADDRESS YOU SEND TO"&lt;/SPAN&gt;

msg &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; MIMEMultipart&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

msg&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'From'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; fromaddr
msg&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'To'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; toaddr
msg&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Subject'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SUBJECT OF THE EMAIL"&lt;/SPAN&gt;

body &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'{} has {} records'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyrfile&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; result&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

msg&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;attach&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;MIMEText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;body&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'plain'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NAME OF THE FILE WITH ITS EXTENSION"&lt;/SPAN&gt;
attachment &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"PATH OF THE FILE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"rb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

part &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; MIMEBase&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'application'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'octet-stream'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
part&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;set_payload&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;attachment&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;read&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
encoders&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;encode_base64&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;part&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
part&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add_header&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Content-Disposition'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"attachment; filename= %s"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

msg&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;attach&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;part&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

server &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; smtplib&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SMTP&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'smtp.gmail.com'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;587&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
server&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;starttls&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
server&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;login&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fromaddr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"YOUR PASSWORD"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
text &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; msg&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;as_string&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
server&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sendmail&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fromaddr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; toaddr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; text&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
server&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;quit&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:15:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641236#M49961</guid>
      <dc:creator>Jeremy_Moore</dc:creator>
      <dc:date>2021-12-12T03:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641237#M49962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response, I have already successfully sent an email,&amp;nbsp;but with just typed text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think your example will work since it refers to attachments which I don't want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tested this out and it does not work, I still receive a blank email body.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 18:30:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641237#M49962</guid>
      <dc:creator>DevinUnderwood3</dc:creator>
      <dc:date>2019-09-19T18:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641238#M49963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What kind of information are you trying to send in the email? Can you also share the code you are working with?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 18:46:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641238#M49963</guid>
      <dc:creator>Jeremy_Moore</dc:creator>
      <dc:date>2019-09-19T18:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641239#M49964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;import smtplib&lt;BR /&gt;from email.mime.text import MIMEText&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;arcpy.ListFiles()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# me is the sender's email address&lt;BR /&gt;# you is the recipient's email address&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;msg = MIMEText(text, 'plain')&lt;BR /&gt;msg['From'] = me&lt;BR /&gt;msg['To'] = you&lt;BR /&gt;msg['Subject'] = "Email"&lt;/P&gt;&lt;P&gt;# email body&lt;BR /&gt;text=' body'&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Send the message via SMTP server&lt;BR /&gt;s=smtplib.SMTP('smtp.escondido.org')&lt;BR /&gt;s.sendmail(me, [you], msg.as_string())&lt;BR /&gt;s.quit()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:12:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641239#M49964</guid>
      <dc:creator>DevinUnderwood3</dc:creator>
      <dc:date>2019-09-19T20:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641240#M49965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just want the returned list of files displayed in the body.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:15:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641240#M49965</guid>
      <dc:creator>DevinUnderwood3</dc:creator>
      <dc:date>2019-09-19T20:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641241#M49966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I edited your code a little bit, I saw some errors. Try this code below and let me know if it works. If it does then we can do some text formatting so it looks pretty.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; smtplib
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; email&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;text &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; MIMEText

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"Enter Your Folder Path"&lt;/SPAN&gt;
listFiles &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFiles&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# me is the sender's email address&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# you is the recipient's email address&lt;/SPAN&gt;
msg &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; MIMEText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;text&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'plain'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
msg&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'From'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; me
msg&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'To'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; you
msg&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Subject'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Email"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# email body&lt;/SPAN&gt;
text &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; listFiles

&lt;SPAN class="comment token"&gt;# Send the message via SMTP server&lt;/SPAN&gt;
s &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; smtplib&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SMTP&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'smtp.escondido.org'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
s&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sendmail&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;me&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;you&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; msg&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;as_string&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
s&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;quit&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:15:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641241#M49966</guid>
      <dc:creator>Jeremy_Moore</dc:creator>
      <dc:date>2021-12-12T03:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641242#M49967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just needed to included the email parameters into my list files loop function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am one step closer to success. I only get a result of the last item in the specified folder.&lt;/P&gt;&lt;P&gt;I need to modify how I am looping the folder and how it passes to the text to loop also.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2019 16:49:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641242#M49967</guid>
      <dc:creator>DevinUnderwood3</dc:creator>
      <dc:date>2019-09-24T16:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641243#M49968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update: I know receive separate emails for each listed file. Now, if can combine all of these emails into just one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2019 16:58:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641243#M49968</guid>
      <dc:creator>DevinUnderwood3</dc:creator>
      <dc:date>2019-09-24T16:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to display Python results into Email Body.</title>
      <link>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641244#M49969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doesn't &lt;EM&gt;arcpy.ListFiles()&lt;/EM&gt; return you all the files' names&amp;nbsp;in your folder as a single string ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2019 07:44:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-display-python-results-into-email-body/m-p/641244#M49969</guid>
      <dc:creator>LeoLiu1</dc:creator>
      <dc:date>2019-09-27T07:44:56Z</dc:date>
    </item>
  </channel>
</rss>

