Re: When I send email as HTML, why do erroneous whitespaces get introduced to the HTML source and a few < > chars get converted to < and > ???

2013-11-11 Thread Richard Balbat
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 < and > ???
> 
> > ...
> 
> > Contents of results.html
> 
> >
> 
> > Test Campaign ResultsSoapUI 
> > regression testing has completed against the following:  
> > Environment: Auto.QABuild: testDetailed results can be found 
> > here: 
> > http://-AUTO1..xxx/SoapUITestResults/Auto.QA-2013-6-11_22-54-50 >  border="1">SoapUI Project 
> > (WSDL/WADL)TotalPassFailurePass 
> > PercentageacceptancePartnerEndpointWSDefinition-soapui-project.xml7 >  color="green">7 > color="red">0100.00%AIM-Automation.xml25 >  color="green">23 > color="red">292.00%ATM-Automation.xml41 >  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


When I send email as HTML, why do erroneous whitespaces get introduced to the HTML source and a few < > chars get converted to < and > ???

2013-11-08 Thread richard . balbat
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 < and > ???


# 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('', 25)
server.ehlo()
server.ehlo()
text = content.as_string()
server.sendmail(fromaddr, recipient_list, text)




Contents of results.html

Test Campaign ResultsSoapUI 
regression testing has completed against the following:  Environment: 
Auto.QABuild: testDetailed results can be found here: 
http://-AUTO1..xxx/SoapUITestResults/Auto.QA-2013-6-11_22-54-50SoapUI Project 
(WSDL/WADL)TotalPassFailurePass 
PercentageacceptancePartnerEndpointWSDefinition-soapui-project.xml770100.00%AIM-Automation.xml2523292.00%ATM-Automation.xml4133880.49%-B2B-GW-soapui-project.xml53521<
 
/td>98.11%CheckoutManager-soapui-project.xml5958198.31%customerManagerWSDefinition-Entity-MGR-soapui-project.xml97277.78%EMP-Automation.xml220100.00%EntityManager---Acceptance-Location-soapui-project.xml123925.00%x-gateway-soapui-project.xml2827196.43%iinDatabaseWSDefinition-Payment-BIN-DB-soapui-project.xml110100.00%LM-ST-Automa
 tion.xml1721511.76%Loyalty-MGW-soapui-project.xml3427779.41%xxx-Automation.xml3329487.88%MobileGateway-soapui-project.xml2272022588.99%-MGW-soapui-project.xml23121152.17%-Automation.xml4237588.10%-gateway-soapui-project.xml32102231.25%
 OM-Automation.xml53530100.00%P-xx-PAYPRO-AP-Automation.xml179852.94%P-xx-POS-Automation.xml124319325.00%P-xx-VP3-Automation.xml2011955.00%PAM-Automation.xml2013765.00%partnerEndpointWSDefinition-soapui-project.xml660100.00%PAYPRO-AP-Automation.xml1211210100
 .00%PAYPRO-IP-Automation.xml3526974.29%POS-Automation.xml1561045266.67%SecureCloud-soapui-project.xml251244.00%Security-Manager-for-Customer-Manager-soapui-project.xml5050.00%Security-Manager-for-Mobile-Gateway-soapui-project.xml210210.00%SecurityManager-for-CustomerPortal-soapui-project.xml150150.00%-Automation.xml302286.67%SMP-Automation.xml2020.00%SSP-REST-API.xml45153033.33%xx-MGW-soapui-project.xml523495.77%TM-EMP-Automation.xml2020.00%TM-SMP-Automation.xml2020.00%TMP-Automation.xml703674.29%TMPAM-Automation.xml211204.76%TMPP-AP-Automation.xml12121191.65%TMPP-IP-Automation.xml261253.85%Transaction-Manager---Acceptance-Location-soapui-project.xml110110.00%Transaction-Manager-for-Customer-Manager(SEC)-soapui-project.xml.xml5050.00%Transaction-Manager-for-Customer-Portal-soapui-project.xml.xml150150.00%Transaction-Manager-for-iinDatabase-Payment-BIN-DB-soapui-project.xml1010.00%Transaction-Manager-for-Mobile-Gateway.xml323299.38%TX-OM-Automation.xml534497.55%XXX-Automation.xml342325.88%Grand 
Totals178594384252.83%

This is what I see in outlook when I view source. Notice the delta. Any idea 
why this is occurring?

color="green">9852.94%P-xx-POS-Automation.xml124319325.00%P-xx-VP3-Automation.xml2011955.00%PAM-Automation.xml2013765.00%partnerEndpointWSDefinition-soapui-project.xml660100.00%PAYPRO-AP-Automation.xml1211210100.00%PAYPRO-IP-Automation.xml3526974.29%POS-Automation.xml156<
 td>1045266.67%SecureCloud-soapui-project.xml251244.00%Security-Manager-for-Customer-Manager-soapui-project.xml5050.00%Security-Manager-for-Mobile-Gateway-soapui-project.xml210210.00%SecurityManager-for-CustomerPortal-soapui-project.xml150150.00%x
 xxx-Automation.xml302286.67%SMP-Automation.xml2020.00%SSP-REST-API.xml45153033.33%xx-MGW-soapui-project.xml523495.77%TM-EMP-Automation.xml2020.00%TM-SMP-Automation.xml2020.00%TMP-Automation.xml703674.29%TMPAM-Automation.xml21
 1204.76%TMPP-AP-Automation.xml12121191.65%TMPP-IP-Automation.xml261253.85%Transaction-Manager---Acceptance-Location-soapui-project.xml110110.00%Transaction-Manager-for-Customer-Manager(SEC)-soapui-project.xml.xml5050.00%Transaction-Manager-for-Customer-Portal-soapui-project.xml.xml150150.00%Transaction-Manager-for-iinDatabase-Payment-BIN-DB-soapui-project.xml<
 td>1010.00%Transaction-Manager-for-Mobile-Gateway.xml323299.38%TX-OM-Automation.xml534497.55%XXX-Automation.xml342325.88%Grand 
Totals178594384252.83%
-- 
https://mail.python.org/mailman/listinfo/python-list