BuffaloHelp 24 Report post Posted April 26, 2009 I've been pulling my hair for the last two days trying to send php mail from my webscript as html format to google apps (or gmail). But I have not been successful. The same script sends to my Yahoo account without an issue. So what is wrong?!? Today I found out that gmail will ignore any external or embedded styles and only accept inline style formats. How interesting. I have been trying to hack this so that I can change 200 formats without editing them one by one. Please help! I tried creating $header .= "<style type=\"text/css\"> <!-- .x125 {border-bottom:thin solid #000000} --> </style>\r\n"; but no success. The only time it will accept my style format is when I place it <td class=x125 style='border-bottom:thin solid #000000'> My html was created using Excel and Saved As Web option. So I do not have control over inline style (by default Excel places style format as embedded). Any suggestions would truly be appreciated. I have created html in Excel and I would like to avoid placing every class=x125 with my own manually. Furthermore, I even tried Find and Replace. But the editor cannot find class=x125. It can find class= and class=x but as soon as I place class=x1 or beyond it says it cannot find. And what's with that about?? (I'm assuming that's another story, another topic). Thanks. Share this post Link to post Share on other sites
Baniboy 3 Report post Posted April 26, 2009 I have no idea about how you could achieve what you wnt. But I tested my code editor with your phrase using find and replace and it worked for me. You could try another code editor, like crimson editor or notepad++. Which one are you using? That is weird indeed, but you could also make the html form yourself, I know it'll take a long time if you have a long form, but hey atleast it'll work(or will it?). Try another code-editor, that's all I can say! Share this post Link to post Share on other sites
eddyruiz 0 Report post Posted April 26, 2009 I would have to agree with the previous poster. You need to try a different editor, but even to create the page. Excel is probably adding a lot of things that you don't want. Notepad++ is free to download so don't worry about the cost. Share this post Link to post Share on other sites
BuffaloHelp 24 Report post Posted April 26, 2009 I used both notepad and crimson editor and both said cannot find 'class=x125' as the search result. Excel, when saved as web, places tons of useless html tags. And that's why I only copied the section which starts with <!--START OF OUTPUT FROM EXCEL PUBLISH AS WEB PAGE WIZARD --> and ended where this appeared <!--END OF OUTPUT FROM EXCEL PUBLISH AS WEB PAGE WIZARD--> Where anything in between these two remarks were nothing but TABLE, TD, TR html tags. I created form version on my own. This form has process.php as application to execute. The process.php then compiles POST variables and sends it as php mail() where mail($to, $from, $subject, $body, $header) I used Excel to create $body by saving Excel as HTML and inserting POST variables to locations I desired. Attached is an example of Excel saved as web. Use this file to replace all class=x125 to style="border-bottom:thin solid #000000;" Thanks guys. Much appreciated. And I'll try code editor to replace strings. Page.htm UPDATE:: It's official, numerous sources point to the same solution--inline style Wonder why the HTML based email sent out by your PHP script will NOT display properly in GMail? GMail will strip all the CSS that is included in between the <style></style> tag pair (internal stylesheet) or the external style sheet included, such as <link rel=”stylesheet” type=”text/css” href=”http://mycss.com/my.css” />. In order to make your HTML or web-based email to properly display in GMail, you must use inline CSS, inside the HTML element , such as <div style=”font-size:8pt;padding:2px;margin:2px;”></div> ajaxapps.com and One of the core recommendations we are proposing is support for embedded CSS in the head. While support for inline CSS is probably better than nothing, it isn't a solid alternative for true, standards-based support. Therefore, because of our recommendation, our acid test does not include inline CSS. Gmail does not support CSS unless it is inline. Consequently not a single item from our list is supported, nor is anything else. But even if Gmail supported embedded styles in the head of a document, it strips all IDs and classes from the source. So we would like to see Google remedy both of these ailments concurrently. email-standards.org it could be a nice project for Xisto code masters... Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 22, 2009 Try:http://premailer.dialect.ca/ For the best HTML e-mail delivery results, CSS should be inline.This is a huge pain and a simple newsletter becomes un-managable veryQuickly. This tool is our solution. CSS styles are converted to inline style attributesChecks style and link[rel=stylesheet] tags and preserves existing inline attributesRelative paths are converted to absolute pathsChecks links in href, src and CSS url('')CSS properties are checked against e-mail client capabilitiesBased on the Email Standards Project?s guidesA plain text version is created -reply by Alex Share this post Link to post Share on other sites