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

Corrupted Base64 Attachments 3-5% of the Time. #21

Open
ClaytonPulman opened this issue Aug 8, 2023 · 4 comments
Open

Corrupted Base64 Attachments 3-5% of the Time. #21

ClaytonPulman opened this issue Aug 8, 2023 · 4 comments

Comments

@ClaytonPulman
Copy link

I would like some help, I have been using this library for some time now in testing. However I have noticed there is corruption in the Base64 output of some email attachments, some of the time. It happens from 3-5% of emails received by the application.

I am running PHP-FPM and Nginx on a Centos9 VM. I have done extensive testing, and I believe it is somewhere within this library.
I have been able to send many emails in quick succession, and compare the raw email output using "$mail" from a corrupted and non corrupted email. When comparing just the Base64 values of the same attachment over two different emails the base64 is corrupted sometimes by a single character. I can sometimes simply add a "0" to the front of a line within the base64 text and it will make the attachment work (base64 validated, and decode works). The strange thing also is the Base64 value within the raw email output will be short, breaking the base64 encoded data.

I have traced the error all the way back to the client.php file, even before it leverages the Zend Mail framework. I have even replaced this all together to use "ZBateson\MailMimeParser" to parse the data, and the issue is still present.

To cross out the thought of corruption in transit of the email to the library (before it gets to the server) I also have tried sending emails from multiple SMTP servers (Apple and Microsoft) both the same, I have also addressed the email to another address also (cc) and compared the received raw output, and the cc addressed email arriving in another mailbox is fine. The issue is somewhere within the library or within the Webserver.

Do you have any ideas?

I have already tried replacing the version of PHP from latest, to version 7, updated the mailparse, all without proper resolution of the issue.

@TheFox
Copy link
Owner

TheFox commented Aug 13, 2023

Hi. Thank you for your message.

This library is not dealing with any base64. I don't know how I would start searching for this issue.

@hemantkjalin
Copy link

Screenshot 2023-08-16 at 1 59 15 PM

Please see the above screenshot, we are dumping $mail contents, where it contains base64 of the attachment, which is corrupted sometimes.

@TheFox
Copy link
Owner

TheFox commented Aug 19, 2023

Is it also happening when you directly dump $mail, without MailMimeParser ?

@hemantkjalin
Copy link

@TheFox Yes, in fact if you see the above screenshot, this mail parser is not doing anything to original $mail object.

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

3 participants