barbushin / php-imap

Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)
MIT License
1.66k stars 457 forks source link

No emails with filter 'ALL' - but when using classic php IMAP function it works #675

Open sirkokoenig opened 2 years ago

sirkokoenig commented 2 years ago

Environment (please complete the following information):

Hi, I can´t get emails, but no error is shown, but when using classic IMAP it works:

    $connection = imap_open('{'.$mailserver.':993/imap/ssl}INBOX', $email, $password);
    $emailstemp = imap_search($connection,'SINCE "'.$start.'" BEFORE "'.$end.'"');
    var_dump($emailstemp);
    ----> Works, shows me emails

    $mailbox = new PhpImap\Mailbox(
'{'.$mailserver.':993/imap/ssl}INBOX', // IMAP server and mailbox folder
$email, // Username for the before configured mailbox
$password, // Password for the before configured username
__DIR__, // Directory, where attachments will be saved (optional)
'UTF-8', // Server encoding (optional)
    true, // Trim leading/ending whitespaces of IMAP path (optional)
    true // Attachment filename mode (optional; false = random filename; true = original filename)
    );
    $mailbox->setAttachmentsIgnore(true);
    // set some connection arguments (if appropriate)
    $mailbox->setConnectionArgs(
        CL_EXPUNGE // expunge deleted mails upon mailbox close
        //| OP_SECURE // don't do non-secure authentication
    );
    try
    {
        $mailsIds = $mailbox->searchMailbox('SINCE "'.$start.'" BEFORE "'.$end.'"');
        var_dump($mailIds);
    }
    ---> Gives me NULL, also when search with 'ALL' gives me NULL