1: <?php
2: /**
3: * Emulates the email sending process for testing purposes
4: *
5: * PHP 5
6: *
7: * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
8: * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
9: *
10: * Licensed under The MIT License
11: * For full copyright and license information, please see the LICENSE.txt
12: * Redistributions of files must retain the above copyright notice.
13: *
14: * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
15: * @link http://cakephp.org CakePHP(tm) Project
16: * @package Cake.Network.Email
17: * @since CakePHP(tm) v 2.0.0
18: * @license http://www.opensource.org/licenses/mit-license.php MIT License
19: */
20:
21: /**
22: * Debug Transport class, useful for emulate the email sending process and inspect the resulted
23: * email message before actually send it during development
24: *
25: * @package Cake.Network.Email
26: */
27: class DebugTransport extends AbstractTransport {
28:
29: /**
30: * Send mail
31: *
32: * @param CakeEmail $email CakeEmail
33: * @return array
34: */
35: public function send(CakeEmail $email) {
36: $headers = $email->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject'));
37: $headers = $this->_headersToString($headers);
38: $message = implode("\r\n", (array)$email->message());
39: return array('headers' => $headers, 'message' => $message);
40: }
41:
42: }
43: