Sending email with Laravel uses a callback closure to set the recipient, subject & other headers. You may need that callback to access variables from the scope of the calling code.
Like this:
[code language=”php”]
$to = ‘CaptainMorgan@example.com’;
Mail::send(‘myEmailView’, [‘data’=>value], function($message) use ($to) {
$message->to($to)->subject(‘Hey, do stuff’);
});
[/code]
Ensure a space after use statement.
Via StackOverflow.