Git Product home page Git Product logo

Comments (7)

Padrio avatar Padrio commented on May 20, 2024

I have the Same Problem (sometimes the authentification takes too Long)

Would vote for it (if the Library has this feature)

Am 15.07.2015 um 06:28 schrieb Ionel Roiban [email protected]:

Would it be possible to setup a timeout on

$connection = $server->authenticate('my_username', 'my_password');
Sometimes (and no idea why) it takes too long to authenticate and I'd rather retry. How do I stop (and debug) php when doing imap_open. Code snippet from /ddeboer/imap/blob/master/src/Server.php below:

public function authenticate($username, $password)
{
    // Wrap imap_open, which gives notices instead of exceptions
    set_error_handler(
        function ($nr, $message) use ($username) {
            throw new AuthenticationFailedException($username, $message);
        }
    );

    $resource = imap_open(
        $this->getServerString(),
        $username,
        $password,
        null,
        1,
        $this->parameters
    );

    if (false === $resource) {
        throw new AuthenticationFailedException($username);
    }

    restore_error_handler();

    $check = imap_check($resource);
    $mailbox = $check->Mailbox;
    $this->connection = substr($mailbox, 0, strpos($mailbox, '}')+1);

    // These are necessary to get rid of PHP throwing IMAP errors
    imap_errors();
    imap_alerts();

    return new Connection($resource, $this->connection);
}


Reply to this email directly or view it on GitHub.

from imap.

ddeboer avatar ddeboer commented on May 20, 2024

It seems this can be done with imap_timeout. Do you feel like opening a PR?

from imap.

Padrio avatar Padrio commented on May 20, 2024

Maybe i will create one in a few hours.

Am 15.07.2015 um 20:39 schrieb David de Boer [email protected]:

It seems this can be done with imap_timeout. Do you feel like opening a PR?


Reply to this email directly or view it on GitHub.

from imap.

ddeboer avatar ddeboer commented on May 20, 2024

Cool!

On Wed, Jul 15, 2015 at 8:42 PM, Pascal Krason [email protected]
wrote:

Maybe i will create one in a few hours.

Am 15.07.2015 um 20:39 schrieb David de Boer [email protected]:

It seems this can be done with imap_timeout. Do you feel like opening a PR?


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub:
#90 (comment)

from imap.

nicosabio2016-zz avatar nicosabio2016-zz commented on May 20, 2024

Hi do you already have a solution for this? I'm having the same problem for this.

from imap.

skynet avatar skynet commented on May 20, 2024

no solution other than to monitor the process and stop if trying to connect runs for too long

from imap.

Slamdunk avatar Slamdunk commented on May 20, 2024

Hi, to me this doesn't seem an issue related to the library, and I can't figure out how we can help to face it.
As said, you can try using imap_timeout which sets global configuration for all imap functions, and so you don't have to wait we implement it to use it.

from imap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.