Skip to content

imap2_fetchbody ignores UID flag #18

Open
@coxlr

Description

@coxlr

Currently the imap2_fetchbody ignores the given flags. Looking at the code the function Massage::fetchBody always sets isUid to true on line 134 when calling fetch:

$messages = $client->fetch($imap->getMailboxName(), $messageNum, true, ['BODY['.$section.']']);

Is there a specific reason for this?

I have tested updating this to be:

$isUid = boolval($flags & FT_UID);

$messages = $client->fetch($imap->getMailboxName(), $messageNum, $isUid, ['BODY['.$section.']']);

And then in the fetch function in the file ImapClient.php added the following to line 2629.

if($is_uid){
    $result[$result[$id]->uid] = $result[$id];
    unset($result[$id]);
}

And I now get the expected message body returned for the given message UID.

I am happy to create a pull request for this, but wanted to checked that wasn't a reason for not using the UID before I went ahead and created the pull request

Metadata

Metadata

Labels

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions