<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*require_once('vendor/tcpdf/examples/tcpdf_include.php');*/
class Quotation extends CI_Controller {
    public function __construct()
    {
        parent::__construct();
        if ($this->session->userdata('logged_in') != 1){
            redirect('home');
        } 
        $this->load->model('quotationmodel');
        $this->load->library('form_validation');
        
    }
    public function sendmail(){
        $attachmentdata = $this->quotationmodel->AttachmentDetailsByID($attachment_id);
        $is_mail=true;
        if($is_mail){
        $config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.gmail.com',
            'smtp_port' => 465,
            'smtp_user' => 'divyasundarsahu@gmail.com',
            'smtp_pass' => 'tvrofmzfixhpynbq',
            'mailtype'  => 'html', 
            'charset'   => 'iso-8859-1'
        );
        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");
        $this->email->from('divyasundarsahu@gmail.com', 'TNT');
        $this->email->to(implode(', ', $to).','.$client_mail->UserEmail);
        $this->email->subject($name_data['name']);
        /*$this->email->isHTML(true); */
        /*Quotation*/
        $this->email->attach("uploads/quotation/$FileNumber-$SlNo.pdf");
        foreach($attachmentdata as $attach)
        {
            
            $this->email->attach("uploads/attachment/$attach->Document");
        }
        
        
        $email_content=$name_data['email_content'];
        $email_footer=$email_signature;
        $message = "$email_content
        $email_footer
        " ;
        $this->email->message($message);
        if ( ! $this->email->send()) {
            show_error($this->email->print_debugger());
        }
    }
}
?>