-
-
Notifications
You must be signed in to change notification settings - Fork 183
Description
Its me once again.
I have one weird issue with emails from my own mail provider.
bee@example[.]com is the mailbox which I access with laravel-imap
I send an email with a text attachment from ey@example[.]com to bee@example[.]com. If I get the message there is no HTML body, only a TEXT body. BUT the text body is replaced with the content of the attached text file. If there would be no attached file, there is still only the TEXT body, but my message is not replaced.
Here is an image. In the image the content is not what I have written into the mail. Its the content from the attached file.
EDIT
I tried to describe the issue once again here: https://stackoverflow.com/questions/59246291/laravel-imap-email-content-is-replaced-with-content-of-attached-text-file.
This is a huge problem. It deletes/replaces the original mail content with the content of the attached file. I thought I can use the rawBody() to somehow parse it myself, but the original content seems to be gone. The rawBody() also displays the contents of the attached text file.
EDIT
I found a thread about this, its currently investigated by the community.
For people who have the issue: #203.
It seems its a bug.
An other thing I always wanted to ask it about sorting the messages by date or id, so the most recent messaged are on page 1. Right now I have a solution, but it feels hacky:
$selectedFolder = $oClient->getFolder($data->folder);
$total_messages = $selectedFolder->query()->all()->count();
$messages_per_page = 40;
$highest_page = ceil($total_messages/$messages_per_page);
$aMessage = $selectedFolder->query()->setFetchFlags(true)->setFetchBody(true)->setFetchAttachment(false)->leaveUnread()->limit(40, $highest_page)->get();
On default the most recent messages are on the highest page. If I simply get all messages and display them as they are I see the old ones first. I also use limit to paginate my results. Right now I count all messages and divide them by the amount per page, so I get the highest page number. I start to display the messages on the highest page number, but it would be great to have a sorting method/solution.
I still struggle with sorting, I also opened a stack question:
https://stackoverflow.com/questions/59210122/laravel-imap-get-messages-sorted-by-most-recent