You are here

public function MailhandlerPhpImapRetrieve::report_errors in Mailhandler 7.2

Same name and namespace in other branches
  1. 6.2 modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php \MailhandlerPhpImapRetrieve::report_errors()

Capture and report IMAP errors.

3 calls to MailhandlerPhpImapRetrieve::report_errors()
MailhandlerPhpImapRetrieve::close_mailbox in modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
Close a mailbox.
MailhandlerPhpImapRetrieve::purge_message in modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
Purge (mark as read or delete) a message.
MailhandlerPhpImapRetrieve::retrieve in modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php
Connect to mailbox and run message retrieval.

File

modules/mailhandler_php_imap/plugins/mailhandler/retrieve/MailhandlerPhpImapRetrieve.class.php, line 429
Definition of MailhandlerPhpImapRetrieve class.

Class

MailhandlerPhpImapRetrieve
Retrieve messages using PHP IMAP library.

Code

public function report_errors($mailbox) {

  // Need to be able to suppress errors when we are testing from an AJAX call.
  // Otherwise we get nasty AJAX dialogs.
  if (!$this->suppress_errors) {
    $errors = imap_errors();
    if ($errors) {
      list(, $caller) = debug_backtrace(FALSE);
      $function = $caller['function'];
      foreach ($errors as $error) {
        if ($error == "SECURITY PROBLEM: insecure server advertised AUTH=PLAIN" && $mailbox->settings['insecure']) {
          continue;
        }
        mailhandler_report('error', 'IMAP error in %function: %error', array(
          '%function' => $function,
          '%error' => $error,
        ));
      }
    }
  }
}