0

I use mail php function for sending mail with laravel. My route:

Route::post('/mailsend', 'Home@contact');

My controller:

public function contact(Request $request){

        $to = '[email protected]';
        $from = $request->input('email');
        $subject = $request->input('subject');
        $message = $request->input('message');
        $headers = 'From: '.$from . "\r\n" .
        'Reply-To: '.$from . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

        mail($to, $subject, $message, $headers);


        return view('contact');
    }

my problem, I can't get my values input in post

enter image description here

Thanks

1 Answer 1

1

You're getting this error because you likely forgot to include the CSRF token in the form that submits to that page.

Make sure to include it like this :

<form method="POST>
  <!-- ... -->

  {{ csrf_field() }}
</form>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.