Avoid undefined index if not define timeout in EmailComponent. Fixes #779

This commit is contained in:
Juan Basso 2010-06-02 18:14:58 -03:00
parent 7682c5896e
commit b480d80c82

View file

@ -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
@ -789,7 +787,13 @@ class EmailComponent extends Object{
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();