Question: I'm getting a mess of these bogus warnings in my log file, and I’d like to suppress them without suppressing legitimate messages:

**PHP Notice: Unknown: SECURITY PROBLEM: insecure server advertised AUTH=PLAIN (errflg=1) in Unknown on line 0**

(I’m connecting to an IMAP service that is only listening to localhost on a server with no third-party users.)

Answer: 
One thing you can do is use the [imap\_errors](http://us3.php.net/manual/en/function.imap-errors.php) and [imap\_alerts](http://us3.php.net/manual/en/function.imap-alerts.php) functions, place this code before your imap\_close.

```
imap_errors();
imap_alerts();

```

What these functions do is return all errors and alerts that have occured and then flushes them. If you do not call these functions they are issued as notices when imap\_close() is called, or the page dies.
As deceze said, it's not really a "bogus" message, it just means that it's a plaintext unencrypted connection.
Here is how you can do :

```
$error = imap_errors();
if (count($error) > 1 || $error[0] != 'SECURITY PROBLEM: insecure server advertised AUTH=PLAIN') {
  // More than 1 error or not the expected error
  var_dump($error);
  throw new Exception('IMAP error detected');
}

```