Reputation: 51
Hei, am trying to send am email in laravel 4.2 to the registered users in my application but am getting an error i dont know how to go about it here is my function
Mail::send('emails.email',array('user'=>$user), function($message)
{
$message->to(Input::get('email'),Input::get('first_name'))->subject('Thank You for Joining bagagga Savings Club');
});
Upvotes: 1
Views: 90
Reputation: 781
This is how i normally do it.
$email = Input::get('email');
$first-name = Input::get('first_name');
Mail::send('emails.email',array('user'=>$user), function($message) use ($email , $first_name)
{
$message->to($email,$first_name)->subject('Thank You for Joining bagagga Savings Club');
});
To pass a variable to an anonymous function, you can use the use construct.
Upvotes: 1