Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29745

Laravel Imap cant check if mail has attachment if setFetchBody is false | setFetchAttachment does not have any effect

$
0
0

I use laravel imap.

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?


Viewing all articles
Browse latest Browse all 29745

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>