public function connect() { $mail=$this->Reports_model_weekly->get_all_usermails(); $i=0; foreach($mail as $email) { $data=array(); $data['company_name']=$email['company_name']; $data['company_id']=$email['id']; $user=$email['customer_name']; $email_id=$email['email_id']; $data['surveys']=$this->Reports_model_weekly->get_surveys($email['id']); $data['locations']=$this->Reports_model_weekly->get_locations($email['id']); $graph=$this->load->view('reports/reports_weekly_graphs',$data); // print("<div style='display: none;'>".print_r($graph)."</div>" ); $pdf_data=$this->pdf_generate($email['id']); /*print("<script>alert('<!--?php print_r($graph);?-->');</script>");*/ $html=$this->load->view('reports/reports_weekly',$pdf_data,true); /* $filename=$data['company_name']; $this->load->library('pdf'); $mpdf = $this->pdf->load(); $mpdf->WriteHTML($html); $mpdf->Output($data['company_name'],'D'); */ $this->db->select('id'); $image1=$this->db->get('weekly_report_image_url')->result_array(); foreach($image1 as $row) { $id1=$row['id']; $this->db->delete('weekly_report_image_url',array('id'=>$id1)); } $this->load->library('email'); $config = array(); $config = $this->mail_config(); $config['mailtype'] = "html"; $this->email->initialize($config); $this->email->from('no-Reply@gmail.com'); $this->email->to('xyz@abc.com'); $this->email->subject("Weekly Report"); $this->email->message($html); /*$filename=$email['company_name']; $this->load->library('pdf'); $mpdf = $this->pdf->load(); $mpdf->WriteHTML($html); //$mpdf->Output($pdfFilePath, 'F'); $mpdf->Output($email['company_name'],'D'); */ if($this->email->send()) { $data['success'] ='<p class="email_sent">An email has been sent to you </p> <p>If you have not received the email:</p> <ul> <li >Please Try to look at it in your spam email box.</li> <li>If it is still not found, you may try to submit the form again to resend it.</li> <li >If the problem persists, please contact us on<a href="mailto:support@txt.com" style="text-decoration:none;"><span style="color:#25a8e0;"> support@txt.com<span></a></li> </ul>'; //print_r($data); exit; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)