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

Method to get all text parts and complete text body #560

Merged
merged 6 commits into from
May 22, 2023

Conversation

arwinvdv
Copy link
Contributor

I tested the library with a mail with 2 attachments send from an iPad. But I didn't get the right body because of multiple plain text parts.

I added the getCompleteBodyText function to get all plain text parts as one string.

@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (7ace12c) 95.10% compared to head (431b518) 95.12%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #560      +/-   ##
============================================
+ Coverage     95.10%   95.12%   +0.02%     
- Complexity      364      365       +1     
============================================
  Files            45       45              
  Lines           939      943       +4     
============================================
+ Hits            893      897       +4     
  Misses           46       46              
Impacted Files Coverage Δ
src/Message/AbstractMessage.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

src/Message/BasicMessageInterface.php Outdated Show resolved Hide resolved
@rudiedirkx
Copy link

Shouldn't getAllContentsByType be called getAllContentsBySubtype since it checks for subtypes. I would use it to find the DELIVERY-STATUS AND RFC822 attachments, which are subtypes. Maybe it's too verbose, but more clear IMO.

@Slamdunk
Copy link
Collaborator

@rudiedirkx can you test this patch to see if it solves #561?

@rudiedirkx
Copy link

@rudiedirkx can you test this patch to see if it solves #561?

It doesn't. It can't because the problem lies somewhere else, in 'attachment detection' in AbstractPart::lazyParseStructure() and/or AbstractPart::isAttachment(). It's not about finding the right part. That's already possible with new RecursiveIteratorIterator($message, RecursiveIteratorIterator::SELF_FIRST). That could be made much easier in this PR with a getAllPartsBy(Sub)type, but that's more for me than for this PR.

@arwinvdv arwinvdv requested a review from Slamdunk May 10, 2023 07:05
@Slamdunk Slamdunk merged commit 424106a into ddeboer:master May 22, 2023
@petraeus
Copy link

Hello, can you return subtype SUBTYPE_RFC822 along with SUBTYPE_PLAIN in getCompleteBodyText message/delivery-status is a subtype used by gmail to return extended smtp error code

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

Successfully merging this pull request may close these issues.

4 participants