02-16-2020, 03:03 AM
I'm trying to send an email from my gmail account to some other gmail address. But my code doesn't seem to work at all.
I have allowed less secure apps to access gmail. Also I'm executing this script on local computer. My PHP version is 7.2.11. Codeigniter version is 3.1.10
PHP Code:
$config = array(
"protocol" => "smtp",
"smtp_host" => "smtp.gmail.com",
"smtp_user" => "[email protected]",
"smtp_pass" => "xxxxxxxx",
"smtp_port" => 587,
"smtp_crypto"=> "tls"
);
$this->load->library("email");
//$this->load->library('encryption');
$this->email->initialize($config);
$this->email->from("[email protected]");
$this->email->to("[email protected]");
$this->email->message("Hello");
$this->email->subject("Test");
$this->email->send();
I have allowed less secure apps to access gmail. Also I'm executing this script on local computer. My PHP version is 7.2.11. Codeigniter version is 3.1.10