Php-imap: 接続時のKerberosエラー

作成日 2013年05月16日  ·  3コメント  ·  ソース: barbushin/php-imap

PHPは、従来のクレデンシャル(ログイン/パスワード)にフォールバックする場合でも、IMAPサーバーがKerberosチケットを必要とする場合に通知を表示します。

PHP Notice:  Unknown: Kerberos error: No credentials cache found (try running kinit) for imap.example.com (errflg=1) in Unknown on line 0

最も参考になるコメント

私の問題を修正するために、サーバーへの接続を実行するときにGSSAPI認証を無効にすることが可能である可能性があります。

$imapStream = @imap_open($this->imapPath, $this->login, $this->password, 0, 0, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));

全てのコメント3件

私の問題を修正するために、サーバーへの接続を実行するときにGSSAPI認証を無効にすることが可能である可能性があります。

$imapStream = @imap_open($this->imapPath, $this->login, $this->password, 0, 0, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));

ありがとう@ tchemineau 、7年後、あなたは私のお尻を救ってくれました。時間かわかりません!!! 🥳

これらのパラメータは、関数setConnectionArgs($options = 0, $retriesNum = 0, $params = null)を使用して設定できます。

<?php

    require_once __DIR__ . '/../vendor/autoload.php';
    use PhpImap\Mailbox;
    use PhpImap\Exceptions\ConnectionException;
    use PhpImap\Exceptions\InvalidParameterException;

    $mailbox = new Mailbox(
        '{imap.gmail.com:993/imap/ssl}INBOX', // IMAP server and mailbox folder
        '[email protected]', // Username for the before configured mailbox
        '*********', // Password for the before configured username
        __DIR__, // Directory, where attachments will be saved (optional)
        'US-ASCII' // Server encoding (optional)    
    );

    try {
        $mailbox->setConnectionArgs(0, 0, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));
    } catch(InvalidParameterException $ex) {
        die("Failed to set connection arguments: " . $ex->getMessage());
    }

    try {
        $mail_ids = $mailbox->searchMailbox('UNSEEN');
    } catch(ConnectionException $ex) {
        die("IMAP connection failed: " . $ex->getMessage());
    } catch (Exception $ex) {
        die("An error occured: " . $ex->getMessage());
    }

    foreach ($mail_ids as $mail_id) { ... }
このページは役に立ちましたか?
0 / 5 - 0 評価

関連する問題

KuenzelIT picture KuenzelIT  ·  18コメント

NeftaliAcosta picture NeftaliAcosta  ·  4コメント

glenelkins1984 picture glenelkins1984  ·  10コメント

dico picture dico  ·  13コメント

billynoah picture billynoah  ·  5コメント