<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Tree3 extends CI_Controller {

	public function index()
	{
		$this->load->view('tree3');
	}
	public function tree3mail(){
		 $config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => 465,
            'smtp_user' => 'pythonfabhost2021@gmail.com', // change it to yours
            'smtp_pass' => 'skive@123', // change it to yours
            'mailtype' => 'html',
            'charset' => 'iso-8859-1',
            'wordwrap' => TRUE
        );
		 $to_email = 'pythonfabhost2021@gmail.com';
        $to_mail = explode(',', $to_email);
         $message = '<html>
                        <head>
                        </head>
                        <center>
                        <body style="margin-top:50px;color:darkgreen">
                        <div style="background-color:#c8f3c8;height: 400px;width: 300px;border:2px solid darkgreen;box-shadow:1px 1px 10px 10px gray">

                            <h2>Tree Status:Healthy</h2>
                            
                            <h3>Tree Name:Papaya Tree</h3>
                            <p>
							Health Percentage: 54 <br>
							Nutrients : 20<br>
							Sunlight : 60 <br>
							 Water : 60 <br>
							 Air : 55<br>
							Tempratute : 50 <br>
							Space : 70<br>
							 Humidity  : 60 <br>
                            </p>
                        </div>
                        </body>
                        </center>
                        </html>';



        $this->load->library('encryption');
        $this->email->initialize($config);
            $this->load->library('email', $config);
        $this->email->set_newline("\r\n");
        $this->email->from('pythonfabhost2021@gmail.com','Tree Owner'); // change it to yours

        $this->email->to($to_mail);// change it to yours
       
        // $this->email->cc('nainarmy412@gmail.com,');
        $this->email->subject('Tree Health Alert');
        $this->email->message($message);
       $dia= $this->email->send();
    
       if($dia==true)
       {
        redirect('home');
       }
       else
       {
        echo "not done";
       }

	}
}
