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

Undocumented breaking change in Mailer when upgrading from 5.5 to 6.x #30592

Closed
lucasvdh opened this issue Nov 14, 2019 · 5 comments
Closed

Undocumented breaking change in Mailer when upgrading from 5.5 to 6.x #30592

lucasvdh opened this issue Nov 14, 2019 · 5 comments

Comments

@lucasvdh
Copy link

  • Laravel Version: 6.0.4
  • PHP Version: 7.2.21
  • Database Driver & Version: not applicable

Description:

I am required to keep a record of all email messages which have been sent. It used to be that I could use the callback in the mailer (Illuminate\Mail\Mailer) to fetch the raw content of an email message (Illuminate\Mail\Message) so I could persist it to storage.

In Laravel 5.5 the callback given to the Mailer@send is ran after the body is set on the message.

Since Laravel 5.6 the callback given to the Mailer@send is ran before the body is set on the message.

This causes the body of the message to not be present in the callback. There is no documentation in the 5.6 upgrade guide about this breaking change that changes the callback from a "after"-callback to a "before"-callback.

Steps To Reproduce:

  1. have a Laravel 5.5 project
  2. send a mail
  3. validate that the email body is present if you call ->toString() on the $message in the callback of Mailer@send
  4. upgrade to Laravel 5.6+
  5. send a mail
  6. call ->toString() on the $message in the callback of Mailer@send
  7. only the header and attachments are returned

Misc

This issue has previously been reported here: laravel/ideas#1646
This issue regards this PR: #22995
This issue regards this specific commit: 0cd8899

@driesvints
Copy link
Member

Hey there,

Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? We'll help you out and re-open this issue if so.

Thanks!

@petermein
Copy link

petermein commented Nov 14, 2019

The not supported comment is great, but then there should be an upgrade guide from 5.5 to 6.x right?
Otherwise what is the point of LTS versions?

@lucasvdh
Copy link
Author

lucasvdh commented Nov 14, 2019

@driesvints if you read my original description you would have seen that my current Laravel version is 6.0.4. I put 5.6+ in the description of the issue because this effects all versions from 5.6 and up.

@lucasvdh lucasvdh changed the title Undocumented breaking change in Mailer when upgrading from 5.5 to 5.6+ Undocumented breaking change in Mailer when upgrading from 5.5 to 6.x Nov 14, 2019
@driesvints
Copy link
Member

@petermein there's an upgrade guide for each version between 5.5 and 6.0. You're always free to send in a PR to one of those.

@lucasvdh but you mention

have a Laravel 5.5 project

Which we don't support anymore. So I didn't understand why you said that 6.0.4 in your issue template. If there's something missing from an upgrade guide, feel free to send in a pr to the docs: https://github.com/laravel/docs/

@Miguel-Serejo
Copy link

There is no documentation in the 5.6 upgrade guide about this breaking change that changes the callback from a "after"-callback to a "before"-callback.

While the upgrade guide could use an itemized index, I'd expect anyone who has trouble with mails after upgrading to ctrl+f the word mail: https://github.com/laravel/docs/blob/5.6/upgrade.md#mail

Mail
withSwiftMessage Callbacks

In previous releases of Laravel, Swift Messages customization callbacks registered using withSwiftMessage were called after the content was already encoded and added to the message. These callbacks are now called before the content is added, which allows you to customize the encoding or other message options as needed.

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

4 participants