- if ( (!$MessArray) or (gettype($MessArray) != "array")) {
- Mail_Fetch_Status(_("Oops, ") . $pop3->ERROR);
- continue 2;
- }
+ while ( (!$MessArray) or (gettype($MessArray) != "array")) {
+ Mail_Fetch_Status(_("Oops, ") . $pop3->ERROR);
+ // re-connect pop3
+ Mail_Fetch_Status(_("Server error...Disconnect"));
+ $pop3->quit();
+ Mail_Fetch_Status(_("Re-connect from dead connectoin"));
+ if (!$pop3->connect($mailfetch_server)) {
+ Mail_Fetch_Status(_("Oops, ") . $pop3->ERROR );
+ Mail_Fetch_Status(_("Saving UIDL"));
+ setPref($data_dir,$username,"mailfetch_uidl_$i_loop", $mailfetch_uidl[$i-1]);
+
+ continue;
+ }
+ $Count = $pop3->login($mailfetch_user, $mailfetch_pass);
+ if (($Count == false || $Count == -1) && $pop3->ERROR != '') {
+ Mail_Fetch_Status(_("Login Failed:") . ' ' . $pop3->ERROR );
+ Mail_Fetch_Status(_("Saving UIDL"));
+ setPref($data_dir,$username,"mailfetch_uidl_$i_loop", $mailfetch_uidl[$i-1]);
+
+ continue;
+ }
+ Mail_Fetch_Status(_("Re-fetching message ") . "$i" );
+ $MessArray = $pop3->get($i);
+
+ } // end while