2011-06-17 17:51:31 -04:30
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Emulates the email sending process for testing purposes
|
|
|
|
*
|
|
|
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
2013-02-08 20:59:49 +09:00
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2011-06-17 17:51:31 -04:30
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
2013-02-08 21:22:51 +09:00
|
|
|
* For full copyright and license information, please see the LICENSE.txt
|
2011-06-17 17:51:31 -04:30
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
2013-02-08 20:59:49 +09:00
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2011-06-17 17:51:31 -04:30
|
|
|
* @link http://cakephp.org CakePHP(tm) Project
|
2011-07-26 01:46:14 -04:30
|
|
|
* @package Cake.Network.Email
|
2011-06-17 17:51:31 -04:30
|
|
|
* @since CakePHP(tm) v 2.0.0
|
2013-05-31 00:11:14 +02:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
2011-06-17 17:51:31 -04:30
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Debug Transport class, useful for emulate the email sending process and inspect the resulted
|
|
|
|
* email message before actually send it during development
|
|
|
|
*
|
2011-07-26 01:46:14 -04:30
|
|
|
* @package Cake.Network.Email
|
2011-06-17 17:51:31 -04:30
|
|
|
*/
|
|
|
|
class DebugTransport extends AbstractTransport {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send mail
|
|
|
|
*
|
2011-07-28 23:56:10 -04:00
|
|
|
* @param CakeEmail $email CakeEmail
|
2011-08-26 02:31:18 +02:00
|
|
|
* @return array
|
2011-06-17 17:51:31 -04:30
|
|
|
*/
|
|
|
|
public function send(CakeEmail $email) {
|
2011-10-23 00:23:50 +11:00
|
|
|
$headers = $email->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject'));
|
2011-06-17 17:51:31 -04:30
|
|
|
$headers = $this->_headersToString($headers);
|
2011-08-29 11:21:46 +02:00
|
|
|
$message = implode("\r\n", (array)$email->message());
|
2011-08-26 02:31:18 +02:00
|
|
|
return array('headers' => $headers, 'message' => $message);
|
2011-06-17 17:51:31 -04:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|