IPB

Welcome Guest ( Log In | Register )



Tags
GMail     CSS     style hacks        
 
Reply to this topicStart new topic

Gmail And Css Style Tips


BuffaloHelp
no avatar
More than meets the eye
******************
Group: Admin
Posts: 3,762
Joined: 23-April 05
From: Trap17 storage box
Member No.: 6,042
myCENT:49.00



Post #1 post Apr 26 2009, 07:19 AM
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.
Go to the top of the page
+Quote Post
Baniboy
no avatar
Super Member
*********
Group: Members
Posts: 446
Joined: 3-November 08
Member No.: 71,342
myCENT:2.94



Post #2 post Apr 26 2009, 08:09 AM
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!
Go to the top of the page
+Quote Post
eddyruiz
no avatar
Member [Level 2]
*****
Group: Members
Posts: 75
Joined: 18-March 09
Member No.: 78,626
myCENT:20.91



Post #3 post Apr 26 2009, 08:44 AM
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.
Go to the top of the page
+Quote Post
BuffaloHelp
no avatar
More than meets the eye
******************
Group: Admin
Posts: 3,762
Joined: 23-April 05
From: Trap17 storage box
Member No.: 6,042
myCENT:49.00



Post #4 post Apr 26 2009, 07:54 PM
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.

Attached File  Page.htm ( 12.77K ) Number of downloads: 3


UPDATE::

It's official, numerous sources point to the same solution--inline style

QUOTE
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

QUOTE
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 Trap17 code masters... wink.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No new   60 andyy15 26,700 3rd September 2004 - 07:30 AM
Last post by: err
No New Posts   9 icleric 6,377 13th August 2004 - 05:03 AM
Last post by: campainer
No New Posts   13 djleli 18,410 28th September 2009 - 08:51 PM
Last post by: phpphp
No new   22 bttfpromo 26,324 16th October 2004 - 11:32 AM
Last post by: Webz
No New Posts   2 xmod 6,223 22nd August 2004 - 12:56 AM
Last post by: issloo
No New Posts   8 Triple X 8,598 26th August 2004 - 08:27 PM
Last post by: Spectre
No New Posts   7 itasor 7,143 25th August 2004 - 04:24 AM
Last post by: Spectre
No New Posts 4 serverph 7,758 30th August 2004 - 11:46 AM
Last post by: Triple X
No New Posts   10 bttfpromo 9,322 2nd September 2004 - 10:03 AM
Last post by: bttfpromo
No new 19 Donegal 10,735 1st February 2005 - 08:28 PM
Last post by: -tweb-
No new   14 melkonianarg 12,972 4th September 2004 - 10:16 PM
Last post by: melkonianarg
No New Posts 7 EricDrinkard 5,343 4th September 2004 - 09:56 AM
Last post by: zip_mc
No New Posts 6 EricDrinkard 6,888 5th September 2004 - 07:38 AM
Last post by: Eric Straven
No New Posts   5 avy 6,644 9th September 2004 - 01:14 PM
Last post by: EricDrinkard
No New Posts   4 psp-playstation 3,992 8th September 2004 - 01:51 AM
Last post by: Lurk


 



RSS Open Discussion Time is now: 8th November 2009 - 11:12 AM

Web Hosting Powered by ComputingHost.com.