phpzend-frameworkzend-mail

Sending mail with css is not applying in zend


I am using zend.Following is my piece of code in my Action

.......
 // create view object
                $html = new Zend_View();
                $html->setScriptPath(APPLICATION_PATH . '/layouts/scripts/');
                // assign values                

                $html->assign('OrderList', $this->view->OrderList);
                $html->assign('title', 'Package Slip');
                $html->assign('current_date', date("F d, Y"));

                // render view
                $bodyText = $html->render('test.phtml');  
                $mail = new Zend_Mail('utf-8');
                $mail->setBodyHtml($bodyText)
                ->setFrom('noreply@metalxplus.com', 'admin')
                ->addTo('dineshkumar.m@openwavecomp.in')
                ->setSubject('Test');
                $mail->send(); 
........

When I echo this $bodyText variable before sending mail, I got complete page with css. But when i send it to mail, css is not applying. What i have to do here? Kindly advice


Solution

  • Many email clients utilise old version of html and therefore do not respect css. Gmail for instance will not respect any css you add to your message.

    To view output, I suggest using either litmus or email on acid which displays how your message will look across a range of email clients.