Unable to send email
In the below codeigniter i want to send a email but i cant send it pls
help me.
Controller:
<?php
/**
* SENDS EMAIL WITH GMAIL
*/
class Email extends CI_Controller
{
function index()
{
$config['protocol'] = 'smtp';
$config['smtp_host'] = "smtp.gmail.com";
$config['smtp_port'] = 465;
$config['smtp_user'] = 'mosesvickson65@gmail.com';
$config['smtp_pass'] = 'mosesvickson65@gmail.com';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('mosesvickson65@gmail.com', 'moses');
$this->email->to('mosesvickson65@gmail.com');
$this->email->subject('This is an email test');
$this->email->message('It is working. Great!');
if($this->email->send())
{
echo 'Your email was sent, successfully.';
}
else
{
show_error($this->email->print_debugger());
}
}
}
?>
It is showing error hello: The following SMTP error was encountered:
Failed to send AUTH LOGIN command. Error: from: The following SMTP error
was encountered: to: The following SMTP error was encountered: data: The
following SMTP error was encountered:
The following SMTP error was encountered: Unable to send email using PHP
SMTP. Your server might not be configured to send mail using this method.
No comments:
Post a Comment