Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

phpmailer sending .css

can phpmailer send a .css file
so I dont have to hardcode the css
Avatar of Kent Dyer
Kent Dyer
Flag of United States of America image

Having to dig through the cobwebs here..

What about using:
<xmp>css code</xmp>

Open in new window


It may be difficult for each email client how they take to display the .css file.

Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@DaveBaldwin very true.

I used to inline css in the email templates  but some email client deny that too.
Yes, HTML email even now is still kind of a mess.
What do you mean by hardcode

* Inline (as part of the element)
* Part of the HTML file

I don't think you are going to get away with an external CSS. I just put the css inside <style> tags in  the <head> section of the HTML email.
Avatar of rgb192


>>What do you mean by hardcode

for every td, do I have to write
<td width="15px" color="red" bgcolor="brown">

I want to use css class or css id

<td class='redbrown'>
To be viewable in all email clients, you probably have to hardcode your styling.  Some email clients like Gmail will totally ignore a <style> section in an HTML email.
Don't try

I want to use css class or css id

<td class='redbrown'>

Open in new window

Instead , you do inline css styling like placing the styles on the corresponding tags.
Avatar of rgb192


best described
and tells me why I have to follow the rules