-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Attachments from apple mail broken #84
Comments
As additional, comparing the original and the saved file:
Note that the broken have a few less bytes then the good one. This pattern repeats. Also comparing the binary of two files, they are identical, except that the broken one stops first. |
Investigating, found this interesting:
but:
This indicates that the problem is somewhere in Psr7 code. I'm using the fopen with memory because I need the stream, not a file, and passing the stream directly causes zero-lenght output on my file driver. |
Interesting, thanks for reporting and investigating. Does this happen with any PDF attachment in apple mail consistently? It could also be a bug in base64 decoding, or some funny/unexpected pattern or character or something happening in the encoded attachment that I'm not handling correctly in zbateson/stream-decorators -- have you tried with a really small test PDF as well? Or it might be something about the size that apple mail generates... anything look strange/different at the 1081344th ((811008 / 3) * 4) character in the base64-encoded email (divide by number of characters in one line of apple-mail generated base64 to find the correct line number)? |
Some points to add:
Also, I workarounded the problem by changing my fileservice to support the response type of |
Aah, so this is strictly related to the Psr7\copy_to_stream call? Maybe something wrong in my stream decorator implementation causing that though, or something about the base64 stream (a character, etc...) itself that's causing something weird to happen. |
PregReplaceFilterStream didn't implement eof(), which caused an issue using stream_get_contents on a guzzle resource created out of the stream zbateson/mail-mime-parser#84 zbateson/mail-mime-parser#87
Thanks for it! |
No problem. For reference if anyone stumbles here, fix was released in 1.1.4 |
@zbateson How did you fix it? I am currently experiencing the same problem but in another context. When I send a pdf from the Gmail webclient it works perfectly, but when I send a pdf from my phone (apple mail client) it does not. I am puzzled! |
Hi @vinceve -- This issue was specific to the base64 decoding component in my library, it was only happening to larger attachments. It wasn't related specifically to apple mail in the end. All the best! |
Trying to parse an email from apple mail with attachments fails. I can't understand why, but the .pdf file doesn't come as attachment, but instead it's an inline.
For some reason, trying to save these attachments from apple mail always create an corrupted file.
I'm using the following code to get attachments:
foreach ($rawMessage->getAllAttachmentParts() as $attachment) {
$contentType = $attachment->getHeader('content-type');
The text was updated successfully, but these errors were encountered: