![]() |
Integrate Google Apps Mail with CodeIgniter - Error - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: Integrate Google Apps Mail with CodeIgniter - Error (/showthread.php?tid=65308) |
Integrate Google Apps Mail with CodeIgniter - Error - Aneri - 05-27-2016 Hello, I am developing a web app. The config details of the same are as follows: Domain - BigRock SMTP : Google Apps configured in BigRock Domain App server - EC2 , Redhat Linux Website - Developed in PHP using MVC architecture based on CodeIgniter. CodeIgniter has been already installed on the app server and is working for fine for everything else. I am running a simple file to test email : public function sendmail() { $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.gmail.com', 'smtp_port' => 465, 'smtp_user' => '[email protected]', 'smtp_pass' => '<<our correct pwd>>', 'mailtype' => 'html', 'charset' => 'iso-8859-1' ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('[email protected]', 'sender name'); $this->email->to('[email protected]'); $this->email->cc('[email protected]'); $this->email->subject('Email Testing'); $this->email->message('Email Working'); if ($this->email->send()) echo "Mail Sent!"; else echo "There is error in sending mail!"; echo $this->email->print_debugger(); } But I am getting and error as provided in attachment. Can you tell me where we are going wrong? Thanks RE: Integrate Google Apps Mail with CodeIgniter - Error - PaulD - 05-27-2016 Code: Failed to authenticate password. It is in your error file. Also, if you are sending your email as HTML you have to send a full HTML page as the email body. RE: Integrate Google Apps Mail with CodeIgniter - Error - arma7x - 05-27-2016 (05-27-2016, 03:50 AM)Aneri Wrote: Hello,Here the instruction link i error files https://support.google.com/mail/answer/78754. Im also got this problem before, but with sailsjs. The problem not with Codeigniter, just follow the instruction in the link. RE: Integrate Google Apps Mail with CodeIgniter - Error - Aneri - 05-27-2016 (05-27-2016, 09:15 AM)PaulD Wrote: Well the password is not the problem. I am logged into the same account and checked it mutiple times. I am using the correct one in the code. But authentication is a problem, hence the error. RE: Integrate Google Apps Mail with CodeIgniter - Error - arma7x - 05-28-2016 https://support.google.com/accounts/answer/6010255 RE: Integrate Google Apps Mail with CodeIgniter - Error - Aneri - 05-28-2016 (05-28-2016, 01:22 AM)arma7x Wrote: https://support.google.com/accounts/answer/6010255 Already done that. So that is not the reason. RE: Integrate Google Apps Mail with CodeIgniter - Error - arma7x - 05-28-2016 PHP Code: $config['protocol'] = 'smtp'; This is my CI email configuration using gmail account. Result :: successfully send email. Make sure to follow all instruction from google troubleshoot. RE: Integrate Google Apps Mail with CodeIgniter - Error - skunkbad - 05-28-2016 It is working for me like this: Code: [ If you still can't send mail, you have to tell Google that you want to use a less secure app: https://support.google.com/accounts/answer/6010255?hl=en RE: Integrate Google Apps Mail with CodeIgniter - Error - Aneri - 05-29-2016 Hello, Thanks for all your help. There was a config file entry in the email.php in the controller config folder. Since I am new to PHP and CodeIgniter both I didn't knew that $this->load->library('email', $config); Was loading the email.php settings. Ideally the email.php data should have been overwritten by $config but is was not. Now I have staright away put the config details in the email.php and using the line $this->load->library('email') And it is working fine with and without the less secure apps setting in google admin. |