Welcome Guest, Not a member yet? Register   Sign In
Using Codeigniter email class with OAuth
#1

[eluser]Unknown[/eluser]
I am trying to send email using Codeigniter's Email library and Google's OAuth. I have managed to authenticate successfully and save the token. I am having trouble with sending using this token instead of a user/pass combination.

The examples given by Google are made for Zend and as such have different parameters and methods. I have also tried manually editing Codeigniter's email library to send these parameters:

Code:
if ($this->xauth != '') {
    $this->_send_data('AUTH XOAUTH2 '.$this->xauth);
    return TRUE;
}

Where xauth is an added parameter sent in the email config, equal to the token needed by Google. (I've added the above lines to Codeigniter's email function _smtp_authenticate)

I am not sure of where to go from here, I still get authentication errors from Google. Below is the full dump from the email debugger. Any help would be appreciated.

Code:
220 mx.google.com ESMTP j10sm19140636wie.1 - gsmtp
hello: 250-mx.google.com at your service, [198.211.124.153]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
250 ENHANCEDSTATUSCODES
Failed to authenticate password. Error: 535-5.7.1 Username and Password not accepted. Learn more at
535 5.7.1 *link*
from: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 *link* j10sm19140636wie.1 - gsmtp
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 *link* j10sm19140636wie.1 - gsmtp
to: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 *link* j10sm19140636wie.1 - gsmtp
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 *link* j10sm19140636wie.1 - gsmtp
data: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 *link* j10sm19140636wie.1 - gsmtp
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 *link* j10sm19140636wie.1 - gsmtp
502 5.5.1 Unrecognized command. j10sm19140636wie.1 - gsmtp
The following SMTP error was encountered: 502 5.5.1 Unrecognized command. j10sm19140636wie.1 - gsmtp
Unable to send email using PHP SMTP.  Your server might not be configured to send mail using this method.User-Agent: CodeIgniter




Theme © iAndrew 2016 - Forum software by © MyBB