Skip to content

setFetchAttachment(true) doesn't do anything if setFetchBody(false) #277

@SDCRoman

Description

@SDCRoman

I am fetchting the mails of a mailbox, which works great.
I need to display an information whether mails have an attachment.

For this I was using this code, which WORKED:

$aMessage = $selectedFolder->messages()->setFetchFlags(true)->setFetchAttachment(true)->setFetchBody(true)->leaveUnread()->limit(40, $highest_page)->get();

The Problem is the load times were bad. To fix this I set setFetchBody to false, which greatly improved the load time. I dont need the body in the overview anyway:

$aMessage = $selectedFolder->messages()->setFetchFlags(true)->setFetchAttachment(true)->setFetchBody(false)->leaveUnread()->limit(40, $highest_page)->get();

Now even with setFetchAttachment(true) the attachment information is lost.
$oMessage->hasAttachments() always returns false.

If I switch back setFetchBody to true it works.

setFetchAttachment does not seem to do anything.

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions