php-imap-client icon indicating copy to clipboard operation
php-imap-client copied to clipboard

Problem with 'remote_system_name'=>$var_name (Can't open mailbox with such a name)

Open JewerlyBony opened this issue 5 years ago • 0 comments

When I try to assign a value to 'remote_system_name' with a variable I get this error : Can't open mailbox with such a name (errflg=2) Here is my simple code :

     $imapserver= "imap.myserver.com";
     ImapClient::setConnectAdvanced();
     ImapClient::setConnectConfig([
          'flags' => [
               'service' => ImapConnect::SERVICE_IMAP,
               'encrypt' => ImapConnect::ENCRYPT_SSL,
               'validateCertificates' => ImapConnect::VALIDATE_CERT
          ],
          'mailbox' => [
               'remote_system_name' => $imapserver,
               'port' => 993
          ],
          'connect' => [
               'username' => $info[0],
               'password' => $info[1]
          ]
     ]);
     $imap = new ImapClient();

But the code works fine when I write imap server directly like this

          'mailbox' => [
               'remote_system_name' => 'imap.myserver.com',
               'port' => 993
          ],

JewerlyBony avatar Jun 21 '20 18:06 JewerlyBony