gcarlopadua
gcarlopadua

Reputation: 31

How to check if IMAP Webklex is connected or not connected

I'm having problems catching the error for the email webklex imap. i want to check if connected or not connected. credentials are correct, i only need to catch if the credentials are wrong or not connected.

Thanks.

$oClient = new Client([
    'host'          => 'imap.gmail.com',
    'port'          => $account_type['port'],
    'encryption'    => 'ssl',
    'validate_cert' => true,
    'username'      => $username,
    'password'      => $password,
    'protocol'      => 'imap'
]);
$oClient->connect();
if(){
//check if connected or not
}

Upvotes: 2

Views: 1212

Answers (1)

Bimal
Bimal

Reputation: 911

Use $oClient->isConnected(); or $oClient->checkConnection(); It really depends on your requirement.

For more information follow the documentation: https://github.com/Webklex/laravel-imap#clientclass

Upvotes: 0

Related Questions