PHP Class Swift_Transport_Esmtp_Auth_XOAuth2Authenticator, Halite

Example: $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 587, 'tls') ->setAuthMode('XOAUTH2') ->setUsername('YOUR_EMAIL_ADDRESS') ->setPassword('YOUR_ACCESS_TOKEN');
See also: https://developers.google.com/google-apps/gmail/xoauth2_protocol
Author: xu.li ([email protected])
Inheritance: implements Swift_Transport_Esmtp_Authenticator
显示文件 Open project: HaliteChallenge/Halite

Public Methods

Method Description
authenticate ( Swift_Transport_SmtpAgent $agent, string $email, string $token ) : boolean Try to authenticate the user with $email and $token.
getAuthKeyword ( ) : string Get the name of the AUTH mechanism this Authenticator handles.

Protected Methods

Method Description
constructXOAuth2Params ( $email, $token ) Construct the auth parameter.

Method Details

authenticate() public method

Try to authenticate the user with $email and $token.
public authenticate ( Swift_Transport_SmtpAgent $agent, string $email, string $token ) : boolean
$agent Swift_Transport_SmtpAgent
$email string
$token string
return boolean

constructXOAuth2Params() protected method

Construct the auth parameter.
See also: https://developers.google.com/google-apps/gmail/xoauth2_protocol#the_sasl_xoauth2_mechanism
protected constructXOAuth2Params ( $email, $token )

getAuthKeyword() public method

Get the name of the AUTH mechanism this Authenticator handles.
public getAuthKeyword ( ) : string
return string