jeudi 17 mars 2016

Why email verification function not taking the to address properly?

This is my function.

public function email_verify_send_mail()
    {
        $inputs = \Input::all();
        $rules = array(
            'email' => 'required|email'
        );
         $validation = Validator::make($inputs, $rules);

        if ($validation->fails()) {
            $messages = $validation->errors();
            return View::make('email_verify')->with('errors', $messages);
        }
        else{
            $in=$inputs['email'];
            //send mail to the user.......
            Mail::send('email_view', ['key' => 'value'], function($message)
            {
                $message->to($inputs['email'])->subject('Welcome!');
            });
            return "okie";


        }
    }

here when i print the $inputs['email'] it clearly print the email address. but when i add that to the mail::send function,it gives an error that Undefined variable: inputs.Why it happens?thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire