Error Sending Email using smtp.office365.com and PHP Codeigniter

Viewed 247

Please help, send email error using SMTP Outlook 365. previously it was still able to run, but suddenly an error.

these my code

$this->load->library('email');
    $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'smtp.office365.com';
        $config['smtp_user'] = 'XXX@XXXX.com';
        $config['smtp_pass'] = '@@@@@@@@@';
        $config['smtp_port'] = '587';
        $config['smtp_crypto'] = 'tls';
        $config['starttls'] = FALSE;
        $config['smtp_timeout'] = '5';
        $config['wordwrap'] = TRUE;
        $config['charset']='iso-8859-1';  
        $config['mailtype'] = 'html';
        $config['newline']="\r\n"; 
        $config['crlf']= "\r\n";    
    $this->email->initialize($config);
    //Email content
    $htmlContent = 'XXX';
    $htmlContent .= 'XXX';
    $this->email->to('XXX@XXXX.com');
    $this->email->from('XXXXX@XXXXX.com','MyWebsite');
    $this->email->subject('How to send email via SMTP server in CodeIgniter');
    $this->email->message($htmlContent);
    //Send email
    $this->email->send();
    if($this->email->send())
        {
            echo "Email sent!!"; 
        } else {
            echo "Email is not sent!!";
            echo $this->email->print_debugger();
        }
}

and these an error result enter image description here

0 Answers
Related