Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some inline attachments are not reachable with ->attachments() #187

Closed
MajkiSVK opened this issue Dec 14, 2021 · 3 comments
Closed

Some inline attachments are not reachable with ->attachments() #187

MajkiSVK opened this issue Dec 14, 2021 · 3 comments

Comments

@MajkiSVK
Copy link

Describe the bug
Some incoming emails have inline attachments, but I can not get them with ->attachments();
Idk if I am doing something wrong or it is a bug :D :)

Code to Reproduce
The troubling code section which produces the reported bug.

 try {
            $client = $this->ConnectToImapClient($model->email);

            $messages = $client->getFolderByPath('INBOX')->messages()->unseen()->get();
        } catch (\Throwable $throwable) {
            $this->loggingService->warningLog($throwable->getMessage(), $throwable->getFile(), $throwable->getLine());
        }

        if (!isset($messages[0])) {
            return null;
        }

        foreach ($messages as $message) {
dd($message, $message->attachments());
}

 private function ConnectToImapClient(string $mail): ?Client
    {
        $mailAccessToken = $this->oauth2Service->GetAccessToken($mail);

        $clientManager = new ClientManager();
        $client = $clientManager->make([
            'host' => 'outlook.office365.com',
            'port' => 993,
            'encryption' => 'ssl', // 'tls',
            'validate_cert' => true,
            'username' => $mail,
            'password' => $mailAccessToken,
            'protocol' => 'imap',
            'authentication' => 'oauth',
        ]);

        $client->connect();

        if ($client->isConnected()) {
            return $client;
        }

    }

Screenshots
image
image

Desktop / Server (please complete the following information):

  • PHP: 7.4.19
  • Version: 2.7.2
  • Provider: Outlook
@eduardom456
Copy link

#370

I believe we are having the same problem.

My temporary solution is reprocessing the same email 4, 5 times, and comparing the amount of attachments identified in each process.

Having identified greater recurrence, I consider the email as "read".

Example, 5 processes of the same email, number of attachments identified in each:

identified 10
identified 11
identified 11
identified 11
identified 10

Not guaranteed, but in theory processed all attachments.

@AdrianKuriata
Copy link
Contributor

Check this PR and give a feedback if it solve your problem. #372

@Webklex
Copy link
Owner

Webklex commented Mar 16, 2023

Please update to v5.1 and give it another try.
If you are currently using an older version below v5.0, please read the breaking changes leading up to v5.1 before upgrading.

Best regards,

@Webklex Webklex closed this as completed Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants