Created
May 24, 2012 10:15
-
-
Save tareko/2780671 to your computer and use it in GitHub Desktop.
Why is email failing?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EMAIL.PHP | |
<?php | |
/** | |
* This is email configuration file. | |
* | |
* Use it to configure email transports of Cake. | |
* | |
* PHP 5 | |
* | |
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) | |
* | |
* Licensed under The MIT License | |
* Redistributions of files must retain the above copyright notice. | |
* | |
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) | |
* @link http://cakephp.org CakePHP(tm) Project | |
* @package app.Config | |
* @since CakePHP(tm) v 2.0.0 | |
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | |
*/ | |
/** | |
* In this file you set up your send email details. | |
* | |
* @package cake.config | |
*/ | |
/** | |
* Email configuration class. | |
* You can specify multiple configurations for production, development and testing. | |
* | |
* transport => The name of a supported transport; valid options are as follows: | |
* Mail - Send using PHP mail function | |
* Smtp - Send using SMTP | |
* Debug - Do not send the email, just return the result | |
* | |
* You can add custom transports (or override existing transports) by adding the | |
* appropriate file to app/Network/Email. Transports should be named 'YourTransport.php', | |
* where 'Your' is the name of the transport. | |
* | |
* from => | |
* The origin email. See CakeEmail::from() about the valid values | |
* | |
*/ | |
class EmailConfig { | |
public $default = array( | |
'transport' => 'Debug', | |
'from' => 'kitab@emlondon.ca', | |
//'charset' => 'utf-8', | |
//'headerCharset' => 'utf-8', | |
); | |
/* public $smtp = array( | |
'transport' => 'Smtp', | |
'from' => array('site@localhost' => 'My Site'), | |
'host' => 'localhost', | |
'port' => 25, | |
'timeout' => 30, | |
'username' => 'user', | |
'password' => 'secret', | |
'client' => null, | |
'log' => false, | |
//'charset' => 'utf-8', | |
//'headerCharset' => 'utf-8', | |
); | |
public $fast = array( | |
'from' => 'you@localhost', | |
'sender' => null, | |
'to' => null, | |
'cc' => null, | |
'bcc' => null, | |
'replyTo' => null, | |
'readReceipt' => null, | |
'returnPath' => null, | |
'messageId' => true, | |
'subject' => null, | |
'message' => null, | |
'headers' => null, | |
'viewRender' => null, | |
'template' => false, | |
'layout' => false, | |
'viewVars' => null, | |
'attachments' => null, | |
'emailFormat' => null, | |
'transport' => 'Smtp', | |
'host' => 'localhost', | |
'port' => 25, | |
'timeout' => 30, | |
'username' => 'user', | |
'password' => 'secret', | |
'client' => null, | |
'log' => true, | |
//'charset' => 'utf-8', | |
//'headerCharset' => 'utf-8', | |
); | |
*/ | |
} | |
Test Function sending email: | |
public function processTrade ($tradeId = NULL) { | |
App::uses('CakeEmail', 'Network/Email'); | |
$email = new CakeEmail(); | |
$email->from(array('me@example.com' => 'My Site')) | |
->to('you@example.com') | |
->subject('About') | |
->send('My message'); | |
} | |
Stacktrace Error: | |
CORE/Cake/Network/Email/CakeEmail.php line 972 → MailTransport->send(CakeEmail) | |
APP/Model/TradesDetail.php line 99 → CakeEmail->send(string) | |
APP/Controller/TradesController.php line 120 → TradesDetail->processTrade(string) | |
[internal function] → TradesController->startUnprocessed() | |
CORE/Cake/Controller/Controller.php line 485 → ReflectionMethod->invokeArgs(TradesController, array) | |
CORE/Cake/Routing/Dispatcher.php line 103 → Controller->invokeAction(CakeRequest) | |
CORE/Cake/Routing/Dispatcher.php line 85 → Dispatcher->_invoke(TradesController, CakeRequest, CakeResponse) | |
APP/webroot/index.php line 96 → Dispatcher->dispatch(CakeRequest, CakeResponse) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment