0

Как мне передать переменную $email в Mail ? И почему она так не передается ? а только нужно писать например

$message->to('[email protected]', '[email protected]')->subject('Login and Password');

Она почему-то undefined variable

$email = '[email protected]';
Mail::send('mail.mail', $data, function($message) {
            $message->to($email, $email)->subject('Login and Password');
            $message->from('[email protected]','[email protected]');
        });

1 ответ 1

2
$email = '[email protected]';
Mail::send('mail.mail', $data, function($message) use ($email) {
    $message->to($email, $email)->subject('Login and Password');
    $message->from('[email protected]','[email protected]');
});

Нужно передать переменную в Closure

use ($email)

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.