Reputation: 249
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
Thanks
Upvotes: 0
Views: 605
Reputation: 5982
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>
Upvotes: 1