Closed dannylifino closed 2 years ago
Hi @dannylifino , many thanks for your report. Which version are you using? If you are using v3.0.0-alpha, please make sure to update your config and add config/imap.php#L151.
It seems like the regex could not be found in Header.php#L176.
Best regards,
@Webklex
Thanks for your fast response once again.
This does not seem to be the problem, however I have debugged the issue and what I found is that when the, Header.php#177 returns an empty string or '\n' for example. This results the parameter being used in the explode() function, and therefore, a delimiter error.
I wrote some code for the getBoundary() which solves this issue. `$regex = isset($this->config["boundary"]) ? $this->config["boundary"] : "/boundary=(.?(?=;)|(.))/i"; $boundary = $this->find($regex);
if ($boundary === null) {
return null;
}
$boundary = $this->clearBoundaryString($boundary);
if ($boundary === '') {
return null;
}
return $boundary;`
However after this i get a 'no content found' error, which torws another getMessagesFailedException:
Webklex\PHPIMAP\Exceptions\GetMessagesFailedException
no content found
at C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Query\Query.php:360 356▕ return $this->populate($available_messages); 357▕ } 358▕ return MessageCollection::make([]); 359▕ } catch (Exception $e) { ➜ 360▕ throw new GetMessagesFailedException($e->getMessage(), 0, $e); 361▕ } 362▕ } 363▕ 364▕ /**
1 C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Query\Query.php:793 Webklex\PHPIMAP\Exceptions\GetMessagesFailedException::("no content found")
2 C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Query\Query.php:274 Webklex\PHPIMAP\Query\Query::handleException()
Hi @dannylifino , can you check if the message you are fetching has actually a body? If it does, can you share the message here?
Best regards,
@Webklex
C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Structure.php:130 ErrorException::("explode(): Empty delimiter")
2 C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Structure.php:130 explode("", "-- Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
This is a multipart Abuse report in ARF format for a message originating from the IP address 2.56.59.217, sent on 13 Oct 2021 18:17:25 -0700
This report consists of three sections:
You are receiving this email because you are an abuse contact listed in one of the following:
Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: message/feedback-report
Source-Ip...")
Hi @dannylifino , as you can see in the explode warning - it's missing the boundary. The message itself seems to be a multipart message. I'm sure there is a boundary somewhere.
In order to reproduce this, I'll need the message itself.
The message header should contain something like this:
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_61853cc4deb13_6b6dc7241634e";
charset=UTF-8
Content-Transfer-Encoding: 7bit
Precedence: list
What boundary regex do you have configured inside config/imap.php#L151 and which version are you using?
Best regards,
@Webklex
'boundary' => '/boundary=(.?(?=;)|(.))/i',
And I am using the 3.0.0-alpha version
Hi @dannylifino , many thanks for the feedback. Please try to replace https://github.com/Webklex/php-imap/blob/7574029286292167d44d7f1ceccaa73ee849bc84/src/Header.php#L179-L181
with:
if ($boundary === null || $boundary === "") {
return null;
}
Does this solve the problem?
Best regards,
@Webklex
That reproduces this problem:
Webklex\PHPIMAP\Exceptions\GetMessagesFailedException
no content found
at C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Query\Query.php:360 356▕ return $this->populate($available_messages); 357▕ } 358▕ return MessageCollection::make([]); 359▕ } catch (Exception $e) { ➜ 360▕ throw new GetMessagesFailedException($e->getMessage(), 0, $e); 361▕ } 362▕ } 363▕ 364▕ /**
1 C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Query\Query.php:793 Webklex\PHPIMAP\Exceptions\GetMessagesFailedException::("no content found")
2 C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Query\Query.php:274 Webklex\PHPIMAP\Query\Query::handleException()
Hi @dannylifino , can you share the entire message / email? Otherwise I'm poking around in the dark. If you don't want to share it here, you can also mail it to github at webklex.com :)
Best regards,
Hi @dannylifino , I'm closing this issue for now. Please give the latest release a try. If the issue persists, feel free to reopen this issue.
Best rgerads,
Hello,
I am trying to fetch emails using the following code:. However I get this error in the Structure.php at line 130.
$inboxMessages = $this->inboxFolder->messages()->all()->get();
Webklex\PHPIMAP\Exceptions\GetMessagesFailedException
explode(): Empty delimiter
at C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Query\Query.php:360 356▕ return $this->populate($available_messages); 357▕ } 358▕ return MessageCollection::make([]); 359▕ } catch (Exception $e) { ➜ 360▕ throw new GetMessagesFailedException($e->getMessage(), 0, $e); 361▕ } 362▕ } 363▕ 364▕ /**
1 C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Structure.php:130 ErrorException::("explode(): Empty delimiter")
2 C:\xampp\htdocs\portal\vendor\webklex\php-imap\src\Structure.php:130 explode("", "--