Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
42.86% |
3 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| |
42.86% |
3 / 7 |
|
0.00% |
0 / 1 |
1.19 | |
0.00% |
0 / 1 |
|
| send | |
42.86% |
3 / 7 |
|
0.00% |
0 / 1 |
1.19 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Pop PHP Framework (https://www.popphp.org/) |
| 4 | * |
| 5 | * @link https://github.com/popphp/popphp-framework |
| 6 | * @author Nick Sagona, III <dev@noladev.com> |
| 7 | * @copyright Copyright (c) 2009-2026 NOLA Interactive, LLC. |
| 8 | * @license https://www.popphp.org/license New BSD License |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * @namespace |
| 13 | */ |
| 14 | namespace Pop\Mail\Transport; |
| 15 | |
| 16 | use Google\Service\Gmail; |
| 17 | use Pop\Http\Client; |
| 18 | use Pop\Mail\Api\AbstractGoogle; |
| 19 | use Pop\Mail\Message; |
| 20 | |
| 21 | /** |
| 22 | * Mailgun API transport class |
| 23 | * |
| 24 | * @category Pop |
| 25 | * @package Pop\Mail |
| 26 | * @author Nick Sagona, III <dev@noladev.com> |
| 27 | * @copyright Copyright (c) 2009-2026 NOLA Interactive, LLC. |
| 28 | * @license https://www.popphp.org/license New BSD License |
| 29 | * @version 4.0.7 |
| 30 | */ |
| 31 | class Google extends AbstractGoogle implements TransportInterface |
| 32 | { |
| 33 | |
| 34 | /** |
| 35 | * Send the message |
| 36 | * |
| 37 | * @param Message $message |
| 38 | * @return mixed |
| 39 | */ |
| 40 | public function send(Message $message): mixed |
| 41 | { |
| 42 | $messageObject = new Gmail\Message(); |
| 43 | $messageObject->setRaw(base64_encode($message->render())); |
| 44 | |
| 45 | $this->verifyToken(); |
| 46 | $this->client->setAccessToken($this->token); |
| 47 | |
| 48 | $gmail = new Gmail($this->client); |
| 49 | $gmail->users_messages->send($this->username, $messageObject); |
| 50 | |
| 51 | return null; |
| 52 | } |
| 53 | |
| 54 | } |