dimanche 3 janvier 2016

Laravel 5.2 - Mail Sent to a variable mail

I want to send mail to a variable mailing address, what I am doing is -

    $this->create($request->all());
    //Send confirmation mail
    $email = $request['email'];
    Mail::send('auth.emails.welcome', ['token' => 'System'], function($message)
    {
        $message
                ->to(
                        $email,
                        'Laravel 5.2 App'
                    )
                ->subject('Activate Your Account !');
    });

But I am getting error like this- enter image description here

Detailed code is-

public function register(Request $request)
{
    $validator = $this->validator($request->all());

    if ($validator->fails()) {
        $this->throwValidationException(
            $request, $validator
        );
    }

    //Auth::login($this->create($request->all()));

    $this->create($request->all());
    //Send confirmation mail
    $email = $request['email'];
    Mail::send('auth.emails.welcome', ['token' => 'System'], function($message)
    {
        $message
                ->to(
                        $email,
                        'Laravel 5.2 App'
                    )
                ->subject('Activate Your Account !');
    });

    return redirect($this->redirectPath());
}

Can anyone please help?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire