|
From: Ulf E. <ulf...@us...> - 2005-09-08 20:14:06
|
Update of /cvsroot/phpbt/phpbt/inc/htmlMimeMail In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30678 Modified Files: htmlMimeMail.php smtp.php Log Message: Don't try to send mail over SMTP when the connection failed Index: htmlMimeMail.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/inc/htmlMimeMail/htmlMimeMail.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- htmlMimeMail.php 8 Sep 2005 20:05:42 -0000 1.5 +++ htmlMimeMail.php 8 Sep 2005 20:13:58 -0000 1.6 @@ -684,7 +684,11 @@ require_once(dirname(__FILE__) . '/smtp.php'); require_once(dirname(__FILE__) . '/RFC822.php'); $smtp = &smtp::connect($this->smtp_params); - + if ($smtp->status != SMTP_STATUS_CONNECTED) { + $this->errors = $smtp->errors; + return false; + } + // Parse recipients argument for internet addresses foreach ($recipients as $recipient) { $addresses = Mail_RFC822::parseAddressList($recipient, $this->smtp_params['helo'], null, false); Index: smtp.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/inc/htmlMimeMail/smtp.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- smtp.php 8 Sep 2005 20:05:42 -0000 1.4 +++ smtp.php 8 Sep 2005 20:13:58 -0000 1.5 @@ -84,7 +84,11 @@ return $obj; }else{ - $this->connection = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout); + $this->connection = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout); + if (!is_resource($this->connection)) { + $this->errors[] = 'Failed to connect to server: '.$errstr; + return FALSE; + } if(function_exists('socket_set_timeout')){ @socket_set_timeout($this->connection, 5, 0); } |