Support the ongoing development of Laravel.io →
Views Mail Queues
Last updated 2 years ago.
0
Solution

Closure doesn't have access to variables in the scope it was defined in. You have to pass $toUser and $subject to it explicitly by adding use($toUser, $subject):

Mail::send('emails.comment_wallpost', $data, function($message) use($toUser, $subject) {
    $message->to($toUser['email'], $toUser['displayname'])->subject($subject);
});
Last updated 9 years ago.
0

@Xum : Thanks bro. working fine now.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.