vernes / YiiMailer

Yii extension for sending emails with layouts using PHPMailer
81 stars 38 forks source link

html format is different when it is sent in email #18

Closed sachy123 closed 8 years ago

sachy123 commented 9 years ago

First of all , Thank you for such a fantastic extension! everything is working fine! except when the email format is different than in html/ i mean the css is not applied there.

My code is

$mail = new YiiMailer();
                    $mail->setView('contact');
                    $mail->setData(
                            array(  'message' => $html, 
                                    'name' => 'John Doe', 
                                    'description' => 'Contact form'
                                ));

                    $mail->setSmtp('smtp.gmail.com', 465, 'ssl', true, 'abcd@gmail.com', '123sk');

                    // $mail->setData(array('message' => 'Message to send', 'name' => 'John Doe', 'description' => 'Contact form'));

                    if ($mail->send()) {
                        echo "Thank you for contacting us. We will respond to you as soon as possible";
                    } else {
                         echo "Error while sending email: ".$mail->getError();
                    }
                    exit();

So I try to echo the $html contents and I get this >>>>>>>>>

screen shot 2014-11-13 at 7 33 29 pm

And when I receive the email the format is as below >>>>> screen shot 2014-11-13 at 7 33 50 pm

vernes commented 8 years ago

Be sure to include full html layout with css and everything. Check your layout file and view file.