imap_mail_move($this->mbox,$i,$archivefolder);//May need some error checking for bad folder names
$msgs++;
$msgs++;
$errors=0;//We are only interested in consecutive errors.
$errors=0;//We are only interested in consecutive errors.
}else{
}else{
...
@@ -384,7 +386,7 @@ class MailFetcher {
...
@@ -384,7 +386,7 @@ class MailFetcher {
$MAX_ERRORS=5;//Max errors before we start delayed fetch attempts - hardcoded for now.
$MAX_ERRORS=5;//Max errors before we start delayed fetch attempts - hardcoded for now.
$sql=' SELECT email_id,mail_host,mail_port,mail_protocol,mail_encryption,mail_delete,mail_errors,userid,userpass FROM '.EMAIL_TABLE.
$sql=' SELECT email_id,mail_host,mail_port,mail_protocol,mail_encryption,mail_delete,mail_archivefolder,mail_errors,userid,userpass FROM '.EMAIL_TABLE.
' WHERE mail_active=1 AND (mail_errors<='.$MAX_ERRORS.' OR (TIME_TO_SEC(TIMEDIFF(NOW(),mail_lasterror))>5*60) )'.
' WHERE mail_active=1 AND (mail_errors<='.$MAX_ERRORS.' OR (TIME_TO_SEC(TIMEDIFF(NOW(),mail_lasterror))>5*60) )'.
' AND (mail_lastfetch IS NULL OR TIME_TO_SEC(TIMEDIFF(NOW(),mail_lastfetch))>mail_fetchfreq*60) ';
' AND (mail_lastfetch IS NULL OR TIME_TO_SEC(TIMEDIFF(NOW(),mail_lastfetch))>mail_fetchfreq*60) ';