Objective-c – HTML email loses formatting after being sent from iPhone program

iphoneiphone-sdk-3.0mfmailcomposeviewcontrollerobjective-c

I'm using MFMailComposeViewController in the iPhone SDK to bring up the mail dialog to send an HTML formatted email. The contents of the message body is being read from an HTML file which is generated in the app and saved on the filesystem. The email looks fine in the send mail dialog and all of the CSS formatting is there. However, after sending the email to gmail and hotmail accounts, the email appears in plain text with all formatting gone. The mail is being sent from my phone using a gmail account.

When I set the message body on the controller I set isHTML to YES. The contents of the html file is very basic; a style block with some CSS defined, and some div containing text. The html file does contain html, head, and body tags (I've also tried it without these tags with just the style and div tags).

Any ideas guys? Been trying to figure this out for close to a day non-stop.

Here's the email window showing the email formatted correctly before sending:
alt text http://img515.imageshack.us/img515/7962/screenshot20091031at114.png

Best Solution

Including the <STYLE/> in the <BODY/> of your HTML should do the trick.