Skip to content

Commit

Permalink
Avoid undefined index if not define timeout in EmailComponent. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Jun 2, 2010
1 parent 7682c58 commit b480d80
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cake/libs/controller/components/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ class EmailComponent extends Object{
* @access public
* @link http://book.cakephp.org/view/1290/Sending-A-Message-Using-SMTP
*/
var $smtpOptions = array(
'port'=> 25, 'host' => 'localhost', 'timeout' => 30
);
var $smtpOptions = array();

/**
* Placeholder for any errors that might happen with the
Expand Down Expand Up @@ -789,7 +787,13 @@ function _mail() {
function _smtp() {
App::import('Core', array('CakeSocket'));

$this->__smtpConnection =& new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->smtpOptions));
$defaults = array(
'host' => 'localhost',
'port' => 25,
'protocol' => 'smtp',
'timeout' => 30
);
$this->__smtpConnection =& new CakeSocket(array_merge($defaults, $this->smtpOptions));

if (!$this->__smtpConnection->connect()) {
$this->smtpError = $this->__smtpConnection->lastError();
Expand Down

0 comments on commit b480d80

Please sign in to comment.