如何检查IMAP Webklex是否已连接

时间:2019-03-30 08:47:12

标签: laravel email imap

我在捕获电子邮件webklex imap的错误时遇到问题。我想检查是否已连接。凭据是正确的,如果凭据错误或未连接,我只需要捕获即可。

谢谢。

$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
}

1 个答案:

答案 0 :(得分:1)

使用tempList = [] for item in thisList: # thisList will be your list tempItem = "" #temporary item for character in item: # I see you have and some floats there if you want and floats then add that or statement if character.isdigit() or character == ".": tempItem = f"{tempItem}{character}" tempList.append(tempItem) $oClient->isConnected(); 这确实取决于您的要求。

有关更多信息,请遵循文档:https://github.com/Webklex/laravel-imap#clientclass

相关问题