Ci PHP使用无法在移动浏览器中运行的媒体发送电子邮件

时间:2018-08-27 08:16:07

标签: php email mobile continuous-integration

帮助我处理可能的电子邮件发件人:我像下面的代码一样使用codeigniter:

      <code>
             $text = " <!DOCTYPE html>
                <html lang='en'>
            <head>
                <meta http-equiv='X-UA-Compatible'>
                <meta name='viewport' content='width=device-width, initial-scale=1.0'>
                <style>
                    #body {
                        font-size: 14px;
                    }
                    h1 {
                        color: blue !important;
                    }
                    .colored {
                        color: blue !important;
                    }
                    .hi { color: blue !important; }
                    #hiid  { color: blue !important; }

                    @media screen and (min-width: 500px) {
                        .colored {
                          color: red !important;
                        }
                        h1 {
                          color: red !important;
                        }
                        .hi { color: red !important; }
                        #hiid  { color: red !important; }
                    }
                    @media screen and (max-device-width: 767px), screen and (max-width: 767px) {
                        .colored {
                          color: blue !important;
                        }
                        h1 {
                          color: blue !important;
                        }
                        .hi { color: blue !important; }
                        #hiid  { color: blue !important; }
                    }
                </style>
            </head>
            <body>
                <div id='body'>
                  <h1 class='hi' id='hiid' style='color: #ff00e0;'>Hi Pierce, ".$acak."</h1>
                  <p class='colored'>This text is blue if the window width is below 500px and red otherwise.</p>
                  <p>Jerry</p>
                </div>
            </body>
            </html>";


           $isi_email = $text;
           $config = array(
                'protocol'    => $this->config->item('protocol'),
                'smtp_host'   => $this->config->item('smtp_host'),
                'smtp_port'   => $this->config->item('smtp_port'),
                'smtp_user'   => $this->config->item('smtp_user'),
                'smtp_pass'   => $this->config->item('smtp_pass'),
                'smtp_crypto' => $this->config->item('smtp_crypto'),
                'mailtype'    => 'html'
            );

        $this->email->initialize($config);
        $this->email->set_newline("\r\n");

        and another setting from/to email
        $this->email->message($isi_email);

        $email = $this->email->send();
</code>

,如果使用桌面浏览器,则会出现以下结果: on desktop browser work normal

,如果我检查功能媒体查询,此结果运行良好: on dekstop browser with media queri check work normal

但是,如果我在移动设备上检查所有样式都不是内联的,则将删除属性(类/ id)元素。 on mobile check view media queri not working jus style inline

我在打开收件箱时检查了我的控制台并收到此错误,但是我不知道为什么。请帮忙 enter image description here

0 个答案:

没有答案