I'm running into an error when trying to send an email using codeigniter. I've tested the function I'm using with an online server but it still throws the same error.
Below is my function:
//send email
function sendEmail() {
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'email', // change it to yours
'smtp_pass' => 'pswd', // change it to yours
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = 'Test message';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('zzz@gmail.com'); // change it to yours
$this->email->to('xxx@gmail.com'); // change it to yours
$this->email->subject('Resume from JobsBuddy for your Job posting');
$this->email->message($message);
if ($this->email->send()) {
echo 'Email sent.';
} else {
show_error($this->email->print_debugger());
}
}
I'm getting the below error:
Failed to authenticate password. Error: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 w84sm8590284ioi.20 - gsmtp Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Kindly assist