[dev] Re: imp's fetchmail support

John Morrissey jwm at horde.net
Wed May 7 18:28:17 PDT 2003


[oops, this should have gone to dev@, not Jan directly]

On Tue, May 06, 2003 at 11:38:09PM +0200, Jan Schneider wrote:
% No, the opposite is correct. It breaks the loop if it found a protocol
% that *didn't* create an error.

D'oh, sorry. I missed the negation.

Could you please have a look at the attached? It eliminates PHP warnings
when a server can't be contacted and also adds the error message from
fsockopen() to the returned error message.

thanks,
john
-- 
John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__
-------------- next part --------------
Index: Fetchmail.php
===================================================================
RCS file: /repository/imp/lib/Fetchmail.php,v
retrieving revision 1.27
diff -u -r1.27 Fetchmail.php
--- Fetchmail.php	26 Feb 2003 18:09:04 -0000	1.27
+++ Fetchmail.php	7 May 2003 21:24:42 -0000
@@ -367,9 +367,9 @@
      */
     function _srvLives()
     {
-        $mailserver = fsockopen($this->_params['server'], $this->_params['port']);
+        $mailserver = @fsockopen($this->_params['server'], $this->_params['port'], $errno, $errstr);
         if (!$mailserver) {
-            return PEAR::raiseError(_("Can't connect to the Mail Server"));
+            return PEAR::raiseError(_("Can't connect to the Mail Server: ") . $errstr);
         } else {
             fclose($mailserver);
         }


More information about the dev mailing list