Python HTML email : customizing output color-coding
All right. Her's what worked for me, just in case anybody bumps into the same problem. I had to enter carriage return (i.e. \n) after my every  tag in the HTML table. And everything worked fine.
PS: One clue as to whether this will help you is that, I am creating one big string of HTML.
I am trying to send a python (2.6) HTML email with color coded output. My script creates an output string which I format to look like a table (using str.format). It prints okay on the screen:
abcd 24222 xyz A
abcd 24222 xyz B
abcd 24222 xyz A
abcd 24222 xyz D
But I also need to send it as an email message and I need to have A (say in Green color), B (in Red) etc. How could I do it?  
What I've tried is attach FONT COLOR = #somecolor & /FONT tags at the front and back of A, B etc. And I wrote a method/module which adds table, tr & td tags) at appropriate parts of the string so that the message would like an HTML table in the email. But, There is an issue with this approach:
1) This doesn't always work properly. The emails (obtained by running the exact same script)  are different and many times with misalligned members and mysterious tr's or td's appearing (at different locations each time). even though my html table creation is correct
Any help would be appreciated.