From b480d80c825fdbb1fee892b1ec18f8483e832f4d Mon Sep 17 00:00:00 2001
From: Juan Basso <jrbasso@gmail.com>
Date: Wed, 2 Jun 2010 18:14:58 -0300
Subject: [PATCH] Avoid undefined index if not define timeout in
 EmailComponent. Fixes #779

---
 cake/libs/controller/components/email.php | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php
index bbc41e72d..5f42bf3cf 100755
--- a/cake/libs/controller/components/email.php
+++ b/cake/libs/controller/components/email.php
@@ -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();