[21321] Fix a potential bug when email notifications are on, but no receiver is found

Caeies <[email protected]> Wed, 25 Aug 2010 09:16:23 +0000
Newsgroups gmane.comp.web.phpgroupware.cvs
Message-ID <[email protected]>
Revision: 21321
          http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21321
Author:   Caeies
Date:     2010-08-25 09:16:22 +0000 (Wed, 25 Aug 2010)
Log Message:
-----------
Fix a potential bug when email notifications are on, but no receiver is found

Modified Paths:
--------------
    modules/tts/branches/branch_0_9_16/inc/functions.inc.php

Modified: modules/tts/branches/branch_0_9_16/inc/functions.inc.php
===================================================================
--- modules/tts/branches/branch_0_9_16/inc/functions.inc.php	2010-08-25 08:44:34 UTC (rev 21320)
+++ modules/tts/branches/branch_0_9_16/inc/functions.inc.php	2010-08-25 09:16:22 UTC (rev 21321)
@@ -138,17 +138,19 @@
 			{
 				$to = current($toarray);
 			}
-    
-			$rc = $GLOBALS['phpgw']->send->msg('email', $to, $subject, stripslashes($body), '', $cc, $bcc);
-			if (!$rc)
+    			if(!empty($to))
 			{
-				echo  lang('Your message could <B>not</B> be sent!<br />')."\n"
-					. lang('the mail server returned').':<br />'
-					. "err_code: '".$GLOBALS['phpgw']->send->err['code']."';<br />"
-					. "err_msg: '".htmlspecialchars($GLOBALS['phpgw']->send->err['msg'])."';<br />\n"
-					. "err_desc: '".$GLOBALS['phpgw']->err['desc']."'.<P>\n"
-					. lang('To go back to the tts index, click <a href= %1 >here</a>',$GLOBALS['phpgw']->link('/tts/index.php','cd=13'));
-				$GLOBALS['phpgw']->common->phpgw_exit();
+				$rc = $GLOBALS['phpgw']->send->msg('email', $to, $subject, stripslashes($body), '', $cc, $bcc);
+				if (!$rc)
+				{
+					echo  lang('Your message could <B>not</B> be sent!<br />')."\n"
+						. lang('the mail server returned').':<br />'
+						. "err_code: '".$GLOBALS['phpgw']->send->err['code']."';<br />"
+						. "err_msg: '".htmlspecialchars($GLOBALS['phpgw']->send->err['msg'])."';<br />\n"
+						. "err_desc: '".$GLOBALS['phpgw']->err['desc']."'.<P>\n"
+						. lang('To go back to the tts index, click <a href= %1 >here</a>',$GLOBALS['phpgw']->link('/tts/index.php','cd=13'));
+					$GLOBALS['phpgw']->common->phpgw_exit();
+				}
 			}
 		}
 	}