Change body in Laravel email sending

 

In case you will ever want to edit / change body of an email before sending it out in Laravel Mail::send() function you can do so in a callback function.

You have a closure function as a third parameter to Mail::send().  This function is called in the middle of send function itself. If you are interested this part of the code is located in

 

How to modify email body inside Mail::send()

Of course there is not much use to set simple “some html string”, you could use Mail::raw() for that. But maybe you will do some additional parsing on the html view.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Please prove me that you are not spamer :) * Time limit is exhausted. Please reload CAPTCHA.