Re: When I send email as HTML, why do erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ???
On Saturday, November 9, 2013 2:29:00 AM UTC-5, dieter wrote: rich writes: Dieter, you were right!!! I broke up the string by inserting CRLF before I reached 72 chars / line. Problem solved! I have the following script that reads in an HTML file containing a table then sends it out via email with a content type of text/html. For some reason a few erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ??? ... Contents of results.html htmlheadtitleTest Campaign Results/title/headbodypSoapUI regression testing has completed against the following: br/br/ Environment: Auto.QAbr/Build: testbr/Detailed results can be found here: http://-AUTO1..xxx/SoapUITestResults/Auto.QA-2013-6-11_22-54-50br/br//ptable border=1trthSoapUI Project (WSDL/WADL)/ththTotal/ththPass/ththFailure/ththPass Percentage/th/trtrtdacceptancePartnerEndpointWSDefinition-soapui-project.xml/tdtd7/tdtdfont color=green7/font/tdtdfont color=red0/font/tdtd100.00%/td/trtrtdAIM-Automation.xml/tdtd25/tdtdfont color=green23/font/tdtdfont color=red2/font/tdtd92.00%/td/trtrtdATM-Automation.xml/tdtd41/tdtdfont color=green ... I suggest to log the generated email (before sending) to verify whether the transformation happens in your script or somewhere during the email transport. The email transport protocol (SMTP - Simple Mail Transfer Protocol) in principle imposes quite a strict limitation on line length (72 characters, when I remember right). Your html input has much larger lines - maybe, they are broken up somewhere - at the cost of spurious whitespace. Usually, a Content-Transfer-Encoding is used to satisfy the line length limitation. If this is quoted printable, then reading the text undecoded, it may seem to have additional characters (whitespace and control characters). I have no idea what may replace and by html entity references. -- https://mail.python.org/mailman/listinfo/python-list
Re: When I send email as HTML, why do erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ???
On Fri, 08 Nov 2013 14:06:38 -0800, richard.balbat wrote: I have the following script that reads in an HTML file containing a table then sends it out via email with a content type of text/html. For some reason a few erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ??? Perhaps it might ne a better idea not to send HTML emails at all. Or if you must, please don't send them to this list. -- https://mail.python.org/mailman/listinfo/python-list
When I send email as HTML, why do erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ???
I have the following script that reads in an HTML file containing a table then sends it out via email with a content type of text/html. For some reason a few erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ??? # Import libraries import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText buffer_results = open('results.html', 'r') HTMLContent = buffer_results.read() print repr(HTMLContent) buffer_results.close() # Send out email notification stating the test execution is completed. COMMASPACE = ', ' fromaddr = x...@aaa.com content = MIMEMultipart() body = MIMEMultipart('alternative') #body.attach(MIMEText(msgtext)) body.attach(MIMEText(HTMLContent, 'html')) content.attach(body) content['From'] = fromaddr recipient_list = [rbalba...@xxx.com,rbalba...@yyy.com] content['To'] = COMMASPACE.join(recipient_list) content['Subject'] = 'Hello World' server = smtplib.SMTP('mail server', 25) server.ehlo() server.ehlo() text = content.as_string() server.sendmail(fromaddr, recipient_list, text) Contents of results.html htmlheadtitleTest Campaign Results/title/headbodypSoapUI regression testing has completed against the following: br/br/ Environment: Auto.QAbr/Build: testbr/Detailed results can be found here: http://-AUTO1..xxx/SoapUITestResults/Auto.QA-2013-6-11_22-54-50br/br//ptable border=1trthSoapUI Project (WSDL/WADL)/ththTotal/ththPass/ththFailure/ththPass Percentage/th/trtrtdacceptancePartnerEndpointWSDefinition-soapui-project.xml/tdtd7/tdtdfont color=green7/font/tdtdfont color=red0/font/tdtd100.00%/td/trtrtdAIM-Automation.xml/tdtd25/tdtdfont color=green23/font/tdtdfont color=red2/font/tdtd92.00%/td/trtrtdATM-Automation.xml/tdtd41/tdtdfont color=green33/font/tdtdfont color=red8/font/tdtd80.49%/td/trtrtd-B2B-GW-soapui-project.xml/tdtd53/tdtdfont color=green52/font/tdtdfont color=red1/font /tdtd98.11%/td/trtrtdCheckoutManager-soapui-project.xml/tdtd59/tdtdfont color=green58/font/tdtdfont color=red1/font/tdtd98.31%/td/trtrtdcustomerManagerWSDefinition-Entity-MGR-soapui-project.xml/tdtd9/tdtdfont color=green7/font/tdtdfont color=red2/font/tdtd77.78%/td/trtrtdEMP-Automation.xml/tdtd2/tdtdfont color=green2/font/tdtdfont color=red0/font/tdtd100.00%/td/trtrtdEntityManager---Acceptance-Location-soapui-project.xml/tdtd12/tdtdfont color=green3/font/tdtdfont color=red9/font/tdtd25.00%/td/trtrtdx-gateway-soapui-project.xml/tdtd28/tdtdfont color=green27/font/tdtdfont color=red1/font/tdtd96.43%/td/trtrtdiinDatabaseWSDefinition-Payment-BIN-DB-soapui-project.xml/tdtd1/tdtdfont color=green1/font/tdtdfont color=red0/font/tdtd100.00%/td/trtrtdLM-ST-Automa tion.xml/tdtd17/tdtdfont color=green2/font/tdtdfont color=red15/font/tdtd11.76%/td/trtrtdLoyalty-MGW-soapui-project.xml/tdtd34/tdtdfont color=green27/font/tdtdfont color=red7/font/tdtd79.41%/td/trtrtdxxx-Automation.xml/tdtd33/tdtdfont color=green29/font/tdtdfont color=red4/font/tdtd87.88%/td/trtrtdMobileGateway-soapui-project.xml/tdtd227/tdtdfont color=green202/font/tdtdfont color=red25/font/tdtd88.99%/td/trtrtd-MGW-soapui-project.xml/tdtd23/tdtdfont color=green12/font/tdtdfont color=red11/font/tdtd52.17%/td/trtrtd-Automation.xml/tdtd42/tdtdfont color=green37/font/tdtdfont color=red5/font/tdtd88.10%/td/trtrtd-gateway-soapui-project.xml/tdtd32/tdtdfont color=green10/font/tdtdfont color=red22/font/tdtd31.25%/td/trtr tdOM-Automation.xml/tdtd53/tdtdfont color=green53/font/tdtdfont color=red0/font/tdtd100.00%/td/trtrtdP-xx-PAYPRO-AP-Automation.xml/tdtd17/tdtdfont color=green9/font/tdtdfont color=red8/font/tdtd52.94%/td/trtrtdP-xx-POS-Automation.xml/tdtd124/tdtdfont color=green31/font/tdtdfont color=red93/font/tdtd25.00%/td/trtrtdP-xx-VP3-Automation.xml/tdtd20/tdtdfont color=green11/font/tdtdfont color=red9/font/tdtd55.00%/td/trtrtdPAM-Automation.xml/tdtd20/tdtdfont color=green13/font/tdtdfont color=red7/font/tdtd65.00%/td/trtrtdpartnerEndpointWSDefinition-soapui-project.xml/tdtd6/tdtdfont color=green6/font/tdtdfont color=red0/font/tdtd100.00%/td/trtrtdPAYPRO-AP-Automation.xml/tdtd121/tdtdfont color=green121/font/tdtdfont color=red0/font/tdtd100 .00%/td/trtrtdPAYPRO-IP-Automation.xml/tdtd35/tdtdfont color=green26/font/tdtdfont color=red9/font/tdtd74.29%/td/trtrtdPOS-Automation.xml/tdtd156/tdtdfont color=green104/font/tdtdfont color=red52/font/tdtd66.67%/td/trtrtdSecureCloud-soapui-project.xml/tdtd25/tdtdfont color=green1/font/tdtdfont color=red24/font/tdtd4.00%/td/trtrtdSecurity-Manager-for-Customer-Manager-soapui-project.xml/tdtd5/tdtdfont color=green0/font/tdtdfont color=red5/font/tdtd0.00%/td/trtrtdSecurity-Manager-for-Mobile-Gateway-soapui-project.xml/tdtd21/tdtdfont color=green0/font/tdtdfont color=red21/font/tdtd0.00%/td/trtrtdSecurityManager-for-CustomerPortal-soapui-project.xml/tdtd15/tdtdfont color=green0/font/tdtdfont
Re: When I send email as HTML, why do erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ???
richard.bal...@gmail.com writes: I have the following script that reads in an HTML file containing a table then sends it out via email with a content type of text/html. For some reason a few erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ??? ... Contents of results.html htmlheadtitleTest Campaign Results/title/headbodypSoapUI regression testing has completed against the following: br/br/ Environment: Auto.QAbr/Build: testbr/Detailed results can be found here: http://-AUTO1..xxx/SoapUITestResults/Auto.QA-2013-6-11_22-54-50br/br//ptable border=1trthSoapUI Project (WSDL/WADL)/ththTotal/ththPass/ththFailure/ththPass Percentage/th/trtrtdacceptancePartnerEndpointWSDefinition-soapui-project.xml/tdtd7/tdtdfont color=green7/font/tdtdfont color=red0/font/tdtd100.00%/td/trtrtdAIM-Automation.xml/tdtd25/tdtdfont color=green23/font/tdtdfont color=red2/font/tdtd92.00%/td/trtrtdATM-Automation.xml/tdtd41/tdtdfont color=green ... I suggest to log the generated email (before sending) to verify whether the transformation happens in your script or somewhere during the email transport. The email transport protocol (SMTP - Simple Mail Transfer Protocol) in principle imposes quite a strict limitation on line length (72 characters, when I remember right). Your html input has much larger lines - maybe, they are broken up somewhere - at the cost of spurious whitespace. Usually, a Content-Transfer-Encoding is used to satisfy the line length limitation. If this is quoted printable, then reading the text undecoded, it may seem to have additional characters (whitespace and control characters). I have no idea what may replace and by html entity references. -- https://mail.python.org/mailman/listinfo/python-list