-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Mail with attachment CSV = bad content-type #29847
Comments
This has been the same for 3 years and no one has reported anything like this until now. Are you sure this is related to the framework? |
Could have sworn I've seen this before when raw mail is used instead of Html due a change in 5.6. |
@driesvints I found the difference between 5.8 and 5.5 https://github.com/laravel/framework/blob/5.8/src/Illuminate/Mail/Mailer.php#L242 https://github.com/laravel/framework/blob/5.5/src/Illuminate/Mail/Mailer.php#L220 On 5.5, call_user_func is after addContent $this->addContent($message, $view, $plain, $raw, $data);
call_user_func($callback, $message); On 5.8 call_user_func is before addContent call_user_func($callback, $message);
$this->addContent($message, $view, $plain, $raw, $data); On 5.8, if I move call_user_func like 5.5, that's work fine... |
Related pull request #22995 |
Hmm this is a tricky one. What would the implications be of reverting that PR? |
I used the raw functionality and that made it work without changing the vendor files:
|
Besides using Mail try some other Method to Send Email |
I have the same issue with Laravel 6.0.4
I receive the plain text instead of the file
|
Same issue as above, in Laravel 5.6 after upgrade...
|
I did this to solve my issue after I upgraded from 5.5 to 5.6, this is ridiculous.... Please fix this!! |
I am the guy, who made 0cd8899 and ultimately broke everyone's email in Laravel 5.6 In retrospect the change in #22995 was a bad idea. But I had my reasons! Anyway, content type like Internally SwiftMailer represents both primary message and all it's parts as subclasses of |
Thank you for explanation @Alexander-- Do you plan to revert to the previous version? |
I am not a Laravel developer — just a guy, who tried to report bug in Laravel and was told to make necessary fixes myself. But personally I wouldn't revert. The change was breaking, but reverting it now will also break any code, that was written to depend on the current behaviour. If we look back at the first public Git commit of Laravel, the callback used to be called before addContent() up to Laravel 5.1 (in 2015). Then @arunpoudel moved it with justification being...
Then I moved it back in Laravel 5.6 (in 2018) with exact same justification. We really should stop moving this callback around and start fixing actual bugs. It seems like both Could we postpone composing actual SwiftMessage until the email is just about to be sent? Current behaviour of immediately invoking attach() goes back to the first version of Laravel, so changing it may break something else, but in my opinion it is worth a try. |
Sent in a fix for this here: #32272 We now basically prevent the header from being modified if it's already been set on the message. |
We had to revert the fix because it was apparently causing some issues. We'll need to find a different way. |
Description:
Hello,
I send specific email : plain text, with body totally empty and CSV file on attachment
No problem with Laravel 5.5 but i've just upgraded to Laravel 5.8 and there's a little bug :
The content-type should by "multipart/mixed" but it is now "plain/text"
Laravel 5.5 => OK
Laravel 5.8 => NOK => bad content-type and base64 on body message
I've change Illuminate/Mail/Mailer.php (https://github.com/laravel/framework/blob/6.x/src/Illuminate/Mail/Mailer.php#L332) and that's work fine
Actual
My change : just deleted "text/plain" parameter
I suppose a bug ?
Steps To Reproduce:
send email : plain text, with body totally empty and CSV file on attachment
The text was updated successfully, but these errors were encountered: