2017-04-05 24 views
2

自分のメールアドレスを入力したばかりのユーザーにメールを送信したいと思います。メールアドレスにメールを送信する - Laravel 5.4

Undefined variable: email

問題がある。このよう

$email = $request->email; 

Mail::send('emails.info', $data, function ($message) { 

    $message->from('[email protected]', 'My Email'); 

    $message->to($email)->subject('The subject'); 

}); 

は、しかし、これはエラーを返しますか?

答えて

4

あなたが働いていた閉鎖使用use

$email = $request->email; 

Mail::send('emails.info', $data, function ($message) use ($email) { 

    $message->from('[email protected]', 'My Email'); 

    $message->to($email)->subject('The subject'); 

}); 
+1

以内にメールを参照する必要があります!ありがとうございました。 –

関連する問題