1

I have a piece of code that connect to an IMAP and download some emails attachments. All worked flawlessy until today, and I can't figure out why, this is the error

This is the code:

Server bug: non-empty initial PLAIN challenge

In my testing environment after modify the line, all works again but when I commit and update the official environment the errors is still there.

if ($this->mbox = imap_open($this->server,$this->username,$this->password,NULL, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'))) ) // I added the last 3 parameters and in local env all works again.
{
    imap_errors();
    return "OK";
}
3
  • 1
    Looks like your server is implementing SASL-PLAIN incorrectly or in a way that your library doesn't like. Try disabling that as well as GSSAPI.
    – Max
    Dec 9, 2015 at 16:54
  • thanks. can you tell me some clue how to disable them? Because the code up here is already disabling the GSSAPI authenticator.
    – Kreker
    Dec 10, 2015 at 8:07
  • I think I did it! I'll post the answer...
    – Kreker
    Dec 10, 2015 at 10:09

1 Answer 1

1

After looking for disable or modify the configuration on the server side I try to add this code to disable the PLAIN authentication and it worked!

So this is my final code. I know it's not so fancy to test the connection like this but...

    if ($this->mbox = imap_open($this->server,$this->username,$this->password) )
    {
        return "OK";
    }elseif ($this->mbox = imap_open($this->server,$this->username,$this->password,NULL, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'))) {
        return "OK";
    }elseif ($this->mbox = imap_open($this->server,$this->username,$this->password,NULL, 1, array('DISABLE_AUTHENTICATOR' => 'PLAIN'))) {
        return "OK";
    }

return imap_last_error();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.