note 77685 deleted from function.imap-open by cmb
| From: | cmb@php.net | Date: | Sun, 20 Oct 2019 09:19:48 +0000 |
| Subject: | note 77685 deleted from function.imap-open by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212731@lists.php.net to get a copy of this message | ||
Note Submitter: bow+php dot net at virtual-habitat dot net
----
Setting a mailbox name (eg INBOX) at the end of the connection string does not work when using
imap_open() with OP_HALFOPEN. You may use imap_reopen() then.
<?php
/* this will fail : */
$connection = imap_open('{mx.example.net}INBOX', 'foo', 'secret',
OP_HALFOPEN.);
$num_mgs = imap_num_msg($connection);
imap_close($connection);
/* this will do : */
$connection = imap_open('{mx.example.net}INBOX', 'foo', 'secret',
OP_HALFOPEN.);
imap_reopen($connection, '{mx.example.net}INBOX');
$num_mgs = imap_num_msg($connection);
imap_close($connection);
?>