send email

 https://www.youtube.com/watch?v=FZfneLNyE4o


    function do_email($msg = NULL, $sub = NULL, $to = NULL, $attachment = NULL) {

        $config = array();
        $config['protocol'] = "smtp";
        $config['smtp_host'] = "ssl://smtp.googlemail.com";
        $config['smtp_port'] = "465";
        $config['smtp_user'] = "marinersbloodcenter@gmail.com";
        $config['smtp_pass'] = "gyhqdnegnqfcqtvu";
        $config['mailtype'] = "html";
        $config['charset'] = "utf-8";
        $config['newline'] = "\r\n";
        $config['wordwrap'] = TRUE;

        $this->load->library('email');

        $this->email->initialize($config);

        $system_name = $this->db->get_where('settings', array('type' => 'system_name'))->row()->description;
        if ($from == NULL)
            $from = 'marinersbloodcenter@gmail.com';
       
       
        $this->email->from($from, $system_name);
        $this->email->from($from, $system_name);
        $this->email->to($to);
        $this->email->subject($sub);

        $this->email->message($msg);
        if($attachment != null){
            $this->email->attach($attachment);
        }
        // Send email
        if ($this->email->send()) {
            //echo 'Email successfully sent, please check.';
        } else {
            $data = $this->email->print_debugger();
            print_r($data);
            exit();
        }
    }

Comments

Popular posts from this blog

date wise search codeigniter

all customer due sql query