public function send_mail_verification(){
$this->load->library('email');
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.gmail.com',
'smtp_port' => '587',
'smtp_crypto' => 'tls',
'smtp_user' => 'myacc@gmail.com',
'smtp_pass' => 'mypass',
'charset' => 'iso-8859-1'
);
$this->email->initialize($config);
$this->email->from('myemail3@gmail.com', 'Registration');
$this->email->to('tosomeonemail@gmail.com');
$this->email->subject('something');
$this->email->message('Testing email.');
if($this->email->send()){
echo "success";
}
else{
show_error($this->email->print_debugger());
}
}
I've been looking at other solution that I find in the internet and none of them worked for me. I've also tried the mail function and changed some things in sendmail.ini and php.ini in xampp and that worked. However, the send mail configuration in codeigniter-3 is much better if I'm going to share my code to other so that they don't need to change some configuration in their sendmail.ini and php.ini. What do you think causes the error?
$this->email->set_newline("\r\n");
I added this one and it worked... wonder why.