I'm running through a tutorial that teaches you the email library in CodeIgniter. I'm using my google credentials to send via smtp but for some reason it is not accepting them. I have tried two different accounts that I am positive I have the correct passwords on and can even log into. However when I try to send a test email from my controller it tells me invalid credentials:
220 mx.google.com ESMTP w6sm15405472anb.3
hello: 250-mx.google.com at your service, [x.x.x.x]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250 ENHANCEDSTATUSCODES
Failed to authenticate password. Error: 535-5.7.1 Username and Password not accepted
I have the correct password, I am certain of it. I can log into the account no problem. Here is my php code:
function index()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smpt_pass' => 'mypassword'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'me');
$this->email->to('[email protected]');
$this->email->subject('Emailing from PHP Codeigniter!');
$this->email->message('Success!');
if($this->email->send())
{
echo 'Your email was sent';
}
else
{
show_error($this->email->print_debugger());
}
}
What am I missing? Thank you!