-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Out of memory when sending large disk attachments #51620
Comments
Thanks. Right now this isn't possible. It's also a bit unclear to me what you mean with "large"? How large are we talking about? |
Thanks for getting back to me.
It's possible to use streams rather than load the file into memory i.e.
The size of the file doesn't really matter if you alter PHP's memory_limit directive i.e. |
I do believe size matters as I don't think it's reasonable to send too large attachments over mail. I think it's best that if you feel something can be improved here that you attempt to send in a PR. If it can be without BC breaks it can adjust the current functionality otherwise it should be a new method. Thanks. |
@driesvints I agree that one shouldn't be sending large files over mail, but the code should be memory efficient and not enforce such limitations in an ungraceful manner. I sent a PR but it was closed without explanation #51601. Perhaps you can offer some insight given it doesn't break BC, and just improves the efficiency of the current functionality. |
Hey @bytestream. It seems Taylor doesn't want to make that change right now. Since we only received one report for this we're going to leave things be sorry. You could always try to overwrite the |
Laravel Version
10.48.12
PHP Version
8.2.19
Database Driver & Version
No response
Description
Sending a mailable with a large disk attachment results in an out of memory exception. This is because the whole file is loaded into memory at
framework/src/Illuminate/Mail/Mailable.php
Line 494 in 97238d2
It should be sent to Symfony mailer as a stream, which is already supported
framework/src/Illuminate/Mail/Message.php
Line 320 in 97238d2
Steps To Reproduce
https://laravel.com/docs/11.x/mail#attaching-files-from-disk
The text was updated successfully, but these errors were encountered: