diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index 6ff13ca97ea3e8e0bdcf02e094465f88277f6d87..fb8402169e83b39c258118329215d2459d7547a2 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -478,15 +478,26 @@ class MailFetcher { $errors++; } - if(($max && $msgs>=$max) || $errors>100) + if($max && ($msgs>=$max || $errors>($max*0.8))) break; } + //Warn on excessive errors + if($errors>$msgs) { + $warn=sprintf('Excessive errors processing emails for %s/%s. Please manually check the inbox.', + $this->getHost(), $this->getUsername()); + $this->log($warn); + } + @imap_expunge($this->mbox); return $msgs; } + function log($error) { + global $ost; + $ost->logWarning('Mail Fetcher', $error); + } /* MailFetcher::run()