使用php Mail / mime发送html和内嵌图像

I am using php/Mail_mime to send styled html content using the code below.

$headers = array ('From' => $sender,
          'To' => implode(',',$to), 
          'Subject' => $subject,
          'Reply-To'=>'myemail@mydomain.com',
          'MIME-Version'=>'1.0',
          'Content-Type'=>'text/html'
    ); 
    /*end header*/

    $this->mime = new Mail_mime();
    $tt=$this->mime;
    $tt->addBcc(implode(',',$bcc));
    $tt->addCc(implode(',',$cc));
    $tt->setTXTBody($text);
    $tt->setHTMLBody($body);
    $tt->addHTMLImage('../images/delete.gif');
//  $tt->addAttachment('../images/delete.gif','image/gif');
    $mime_body = $tt->get();
    $mime_hdrs = $tt->headers($headers);

    $smtp = Mail::factory('smtp',
    array ('host' => $this->host,
            'port' => $this->port, 
            'auth' => false, 
            'username' => $this->username, 
            'password' => $this->password)); 
    $recipients=array_merge($to,$cc,$bcc);
    $mail = $smtp->send($recipients, $mime_hdrs, $mime_body);

This is all a class code, so initialization is done on the constructor, which is not posted here.

Now my question is, while the above code works fine, i didnt see the correct style on the email sent.

for example if i have this as a message body of my email:

<div style="background-color:silver;">

<h1>MY Header</h1> </div>

On my email, I can only see the My Header. The background didnt showup as silver.

What did i miss on my code above. Any help ?

Its quite possible that the email provider you are using doesn't allow HTML code in the emails, or it restricts CSS styling in the allowed HTML code. Which email provider are you using?

You might want to test this by sending an email to a gmail.com email address, which does allow html code, and see if it makes any difference.

Another thing to test would be to do a view source, or inspect element if you're using google chrome or firebug in firefox, and see if the html code is being placed where it should be.