ddeboer / imap

Object-oriented, fully tested PHP IMAP library
MIT License
889 stars 252 forks source link

Get sent mailbox #508

Open Herz3h opened 3 years ago

Herz3h commented 3 years ago

I previously used Horde_Imap_Client and it had this feature of fetching mailboxes attributes and adding \sent attribute on the sent mailbox. I've tried to do the same with this library with $mailbox->getAttributes(), but it returns a number 64. Not sure what this means.

Is there a similar way to filter mailbox by \sent attribute ?

Thank you

Herz3h commented 3 years ago

Apparently this an imap extension that allows the client to specify SPECIAL-USE, this could be very helpful https://datatracker.ietf.org/doc/html/rfc6154

Slamdunk commented 3 years ago

Hi, Mailbox::getAttributes return the attributes gathered by imap_getmailboxes, see https://www.php.net/manual/en/function.imap-getmailboxes.php#refsect1-function.imap-getmailboxes-returnvalues

$ php -r 'print_r(get_defined_constants());'| grep LATT_
    [LATT_NOINFERIORS] => 1
    [LATT_NOSELECT] => 2
    [LATT_MARKED] => 4
    [LATT_UNMARKED] => 8
    [LATT_REFERRAL] => 16
    [LATT_HASCHILDREN] => 32
    [LATT_HASNOCHILDREN] => 64

This library is just an OOP wrapper to the imap extension, while Horde seems to be a native implementation of the IMAP protocol.

If you find a way within php-imap ext to have this feature, we can implement it too.