zendframework/zf2 — pull request #5728 by rodnaph (2014-01-18 19:59:58+00:00)
Title: adds XOAUTH2 (ie. Gmail) authentication support for SMTP

Example usage:

```php
use Zend\Mail;

$email = ''; // from email
$accessToken = ''; // valid access token

$message = new Mail\Message();
$message->setBody('some body text');
$message->setFrom($email, 'Some Sender');
$message->addTo("person@example.com", 'Some Person);
$message->setSubject('Test sending by SMTP via Gmail');

$options = new Mail\Transport\SmtpOptions(
array(
'host' => 'smtp.gmail.com',
'port' => 587,
'connection_class' => 'xoauth2',
'connection_config' => array(
'ssl' => 'tls',
'email' => $email,
'accessToken' => $accessToken
)
)
);

$transport = new Mail\Transport\Smtp();
$transport->setOptions($options);
$transport->send($message);
```