I have a variable
$mail_body = array(
'text/html' =>
'<style> .fb_term { font-weight:bold;
border-bottom: 1px solid #999999;
}</style>' );
and inside my code I do this
$mail_body['text/html'] .= $a;
$a ='How <span class="fb_term" >Assist</span> me Please <span class="fb_term" >Grad</span>'
I get the mail but the styling is not done,
What could be the problem?
The problem could be e-mail HTML, which is notoriously difficult to style. Don't use classes, use inline styles for every bit of CSS.
How <span style="font-weight:bold; border-bottom: 1px solid #999999;" >Assist</span> me Please <span style="font-weight:bold; border-bottom: 1px solid #999999;" >Grad</span>
What mail browser did you use to test output (Gmail, Hotmail, Yahoo or Outlook)? Are you sure they all support style
tags? Are you sure they all support the css directives you used for your elements.
I suggest you take a look at this site, it has some test data on css directives and mail browsers. And use directives in-line not in a style
tag. For example:
<div style="background-color:black;color:white"></div>
Also make sure you mark the correct mail header Content-Type
as text/html
. If it is just text
, it wont be rendered correctly.