使用php向gmail发送正确的html消息?

We have simple php class, that sends messages via php mail

   $message = file_get_contents($this->message_file);
   $this->message = base64_encode($message);
   foreach($this->to as $to){
             $code .= '
    $to = "'.$to.'";

    $headers  = "MIME-Version: 1.0" . "
";
    $headers .= "Content-type: text/html; charset=UTF-8" . "
";
    $headers .= "From: '. $this->from .' " . "
";

    $subject = "Test message from ".$_SERVER[\'SERVER_NAME\'];


    mail($to, $subject, base64_decode("'.$this->message.'"), $headers);
    ';

It worked fine until we had to send proper HTML page with CSS, images and other stuff. Gmail just doesn't show it correct (no images, no css). How can I resolve this and format message in the proper way so google mail will display it right?