Sending html email using CodeIgniter using SMTP

public function send_mailtest()
{
       $config = Array(
            'protocol' => 'smtp',
            'smtp_host' => 'xxxx.xxx-xx.com',
            'smtp_port' => 25,
            'smtp_user' => 'xxxx@xxxx.xxx-xx.com',
            'smtp_pass' => 'zxxxxx',
            'mailtype'  => 'html', 
            'charset'   => 'iso-8859-1'
        );
        
        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");
        $this->email->from('xxx@xxxx.com', 'xxx');
        $this->email->to('xxx@xxxxx.com');
        $this->email->subject('Email Test');
        $this->email->message('Testing the email class.');
        echo $this->email->send();
}

Leave a comment